Skip to content

Commit

Permalink
Neuwo RTD Provider : api url required in configuration (#9565)
Browse files Browse the repository at this point in the history
* added neuwoRtdProvider.js (implementation), integration test spec, initial description document (neuwoRtdProvider.md)

* neuwoRtdProvider finish: added _example.html using https://docs.prebid.org/dev-docs/examples/basic-example.html
improved neuwoRtdProvider logging and error handling
improved neuwoRtdProvider.md testing steps

* neuwoRtdProvider.js -> updated to convert response using IAB to Tax ID conversion dictionary
+tests, finished "no response" test

* neuwoRtdProvider.js: added BILLABLE_EVENTs: 'auction' on getBidRequestData, 'request' on successful parse of neuwo request, 'general' on if global data actually extended using topics

* review reflections: added injection into site.cattax, site.pagecat for "IAB 2.2", clarified conversion code conversion dictionary comment to include IAB 2+ - added tests to further ensure endpoint response malformation handling robustness

* neuwoRtdProvider.js -> updated segtax code to compatible non-deprecated version (2.0 -> to 2.2, used conversion table is the same)

* neuwoRtdProvider.js -> reduced:
- amount and mutability of variables (const)
- responsibility of injectTopics, callback lifted into callbacks of the ajax call
- amount of billable events, on api call success only (expects marketing_categories)

* configurable API endpoint, documentation update
  • Loading branch information
moquity authored Feb 23, 2023
1 parent 7d1d1a9 commit a914e50
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
12 changes: 11 additions & 1 deletion integrationExamples/gpt/neuwoRtdProvider_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,18 @@
let fieldElem = document.getElementById('token-to-use');
let publicToken = fieldElem ? fieldElem.value : '';
if (!publicToken) {
alert('please enter your token for Neuwo AI API on the field');
alert('please enter your token for Neuwo AI API to the field');
if (fieldElem) fieldElem.focus();
return;
}
let apiUrlField = document.getElementById('neuwo-api-url');
let apiUrl = apiUrlField ? apiUrlField.value : '';
if (!apiUrl) {
alert('please enter Neuwo AI API url to the field');
if (apiUrlField) apiUrlField.focus();
return;
}

let urlElem = document.getElementById('url-to-use');
let argUrl = urlElem ? urlElem.value : undefined;
pbjs.que.push(function() {
Expand All @@ -106,6 +114,7 @@
waitForIt: true,
params: {
publicToken,
apiUrl,
argUrl
}
}
Expand Down Expand Up @@ -161,6 +170,7 @@ <h2>Basic Prebid.js Example using neuwoRtdProvider</h2>
</div>
<div>
<p>Add token and url to use for Neuwo extension configuration</p>
<input type="text" placeholder="Neuwo API url" id="neuwo-api-url" />
<input type="text" placeholder="Token for Neuwo API" id="token-to-use" />
<input type="text" placeholder="Use url for site" id="url-to-use" />
<button onClick="onSettingsUpdate()">Update</button>
Expand Down
6 changes: 5 additions & 1 deletion modules/neuwoRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ function init(config = {}, userConsent = '') {
logError('publicToken missing', 'NeuwoRTDModule', 'config.params.publicToken')
return false;
}
if (!config.params.apiUrl) {
logError('apiUrl missing', 'NeuwoRTDModule', 'config.params.apiUrl')
return false;
}
return true;
}

Expand All @@ -26,7 +30,7 @@ export function getBidRequestData(reqBidsConfigObj, callback, config, userConsen
logInfo('NeuwoRTDModule', 'starting getBidRequestData')

const wrappedArgUrl = encodeURIComponent(config.params.argUrl || getRefererInfo().page);
const url = 'https://m1apidev.neuwo.ai/edge/GetAiTopics?' + [
const url = config.params.apiUrl + [
'token=' + config.params.publicToken,
'lang=en',
'url=' + wrappedArgUrl
Expand Down
13 changes: 11 additions & 2 deletions modules/neuwoRtdProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ Maintainer: neuwo.ai

# Description

Real-time data provider for Neuwo AI. Contact neuwo.ai [https://neuwo.ai/contact-us] for more information.
The Neuwo AI RTD module is an advanced AI solution for real-time data processing in the field of contextual targeting and advertising. With its cutting-edge algorithms, it allows advertisers to target their audiences with the highest level of precision based on context, while also delivering a seamless user experience.

The module provides advertiser with valuable insights and real-time contextual bidding capabilities. Whether you're a seasoned advertising professional or just starting out, Neuwo AI RTD module is the ultimate tool for contextual targeting and advertising.

The benefit of Neuwo AI RTD module is that it provides an alternative solution for advertisers to target their audiences and deliver relevant advertisements, as the widespread use of cookies for tracking and targeting is becoming increasingly limited.

The RTD module uses cutting-edge algorithms to process real-time data, allowing advertisers to target their audiences based on contextual information, such as segments, IAB Tiers and brand safety. The RTD module is designed to be flexible and scalable, making it an ideal solution for advertisers looking to stay ahead of the curve in the post-cookie era.

Generate your token at: [https://neuwo.ai/generatetoken/]

# Configuration

Expand All @@ -15,7 +23,8 @@ Real-time data provider for Neuwo AI. Contact neuwo.ai [https://neuwo.ai/contact
const neuwoDataProvider = {
name: 'NeuwoRTDModule',
params: {
publicToken: '<public token here>'
publicToken: '<public token here>',
apiUrl: '<replace this with your Neuwo API url>'
}
}
pbjs.setConfig({realTimeData: { dataProviders: [ neuwoDataProvider ]}})
Expand Down
3 changes: 2 additions & 1 deletion test/spec/modules/neuwoRtdProvider_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import * as neuwo from 'modules/neuwoRtdProvider';
const PUBLIC_TOKEN = 'public_key_0000';
const config = () => ({
params: {
publicToken: PUBLIC_TOKEN
publicToken: PUBLIC_TOKEN,
apiUrl: 'https://testing-requirement.neuwo.api'
}
})

Expand Down

0 comments on commit a914e50

Please sign in to comment.