Skip to content

Commit b18b4b6

Browse files
authored
docs: add integration guide for PrebidJS analytics (#265)
1 parent be35d65 commit b18b4b6

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ JavaScript SDK for integrating with an [Optable Data Connectivity Node (DCN)](ht
1616
- [Targeting API](#targeting-api)
1717
- [Witness API](#witness-api)
1818
- [Using a script tag](#using-a-script-tag)
19+
- [Integrating PrebidJS analytics](#integrating-prebidjs-analytics)
20+
- [Script tag](#script-tag-1)
21+
- [NPM package](#npm-package)
1922
- [Integrating GAM360](#integrating-gam360)
2023
- [Targeting key values](#targeting-key-values)
2124
- [Targeting key values from local cache](#targeting-key-values-from-local-cache)
@@ -392,6 +395,58 @@ You can also manually initialize the SDK using the cmd queue. This approach is u
392395
<input type="text" id="email" value="some.email@address.com" />
393396
```
394397

398+
## Integrating PrebidJS analytics
399+
400+
The `OptablePrebidAnalytics` addon hooks into [Prebid.js](https://prebid.org/) auction events (`auctionEnd` and `bidWon`) and sends auction analytics to the Optable DCN via the **witness API**. It reports per-bidder EID coverage, bid outcomes, and optional custom key-value pairs, enabling you to measure the impact of Optable targeting on your Prebid auctions.
401+
402+
### Script tag
403+
404+
When the SDK is loaded via a `<script>` tag, `OptablePrebidAnalytics` is available as `window.optable.OptablePrebidAnalytics`.
405+
406+
```html
407+
<!-- Optable SDK async load: -->
408+
<script async src="https://cdn.optable.co/web-sdk/v0/sdk.js"></script>
409+
410+
<!-- Prebid.js async load: -->
411+
<script async src="prebid.js"></script>
412+
413+
<script>
414+
window.optable = window.optable || { cmd: [] };
415+
window.pbjs = window.pbjs || { que: [] };
416+
417+
optable.cmd.push(function () {
418+
optable.instance = new optable.SDK({ host: "dcn.customer.com", site: "my-site" });
419+
420+
const analytics = new optable.OptablePrebidAnalytics(optable.instance, {
421+
analytics: true,
422+
tenant: "my_tenant", // Replace with your Optable tenant name
423+
});
424+
425+
analytics.hookIntoPrebid(window.pbjs);
426+
});
427+
</script>
428+
```
429+
430+
### NPM package
431+
432+
When using the SDK as an NPM package, import `OptablePrebidAnalytics` directly from the addon module:
433+
434+
```javascript
435+
import OptableSDK from "@optable/web-sdk";
436+
import OptablePrebidAnalytics from "@optable/web-sdk/lib/addons/prebid/analytics";
437+
438+
const sdk = new OptableSDK({ host: "dcn.customer.com", site: "my-site" });
439+
440+
const analytics = new OptablePrebidAnalytics(sdk, {
441+
analytics: true,
442+
tenant: "my_tenant", // Replace with your Optable tenant name
443+
});
444+
445+
analytics.hookIntoPrebid(window.pbjs);
446+
```
447+
448+
For extended configuration options such as sampling, debug mode, and custom analytics data, see the [Prebid analytics addon README](lib/addons/prebid/README.md).
449+
395450
## Integrating GAM360
396451

397452
The Optable Web SDK can fetch targeting data from a DCN and map it to be sent to [Google Ad Manager 360](https://admanager.google.com/home/) ad server account for real-time targeting. It's also capable of intercepting advertising events from the [Google Publisher Tag](https://developers.google.com/doubleclick-gpt/guides/get-started) and logging them to a DCN via the **witness API**.

0 commit comments

Comments
 (0)