Example: targeting API: Prebid.js

Shows how to load active cohorts for a visitor and pass them to Prebid.js via setConfig-fpd. It's assumed in this example that your primary ad server is Google Ad Manager (GAM) and that you are integrated with it using the Google Publisher Tag (GPT), so we also pass matching active cohorts to GAM.

In this example, we use the prebidORTB2FromCache() API to retrieve any targeting data from browser LocalStorage, in order to pass it to Prebid.js via seller defined audiences. We also call the SDK targeting API which will fetch the latest targeting data from our DCN and cache it locally for later use. Since these two events happen asynchronously, it's possible that the targeting data passed to Prebid is slightly outdated. To ensure ad targeting accuracy, it is recommended to call targeting to update the local cache on page load.