You can pass page level custom KV data into Google Ad Manager with the following API:
window.dataLayer = window.dataLayer || []
dataLayer.push({
event: 'gam.targeting',
KEY_NAME: VALUES,
})
For example:
window.dataLayer = window.dataLayer || []
dataLayer.push({
event: 'gam.targeting',
keywords: ['English Premier League'],
pageType: 'article',
})
You can use the following API to disable the advertising on a URL:
window.dataLayer = window.dataLayer || []
dataLayer.push({
event: 'bs.targeting',
articleType: 'noads',
})
if (window.BIDDINGSTACK) {
window.BIDDINGSTACK.api.teardown()
window.BIDDINGSTACK.api.bootstrap()
}
If the website utilises infinite scrolling, there could be new ad slots added to the page dynamically. You have to call the following API after content is rendered on the page, and then the engine will fill ads into the new ad slots.
if (window.BIDDINGSTACK) {
window.BIDDINGSTACK.api.discoverSlots()
}
You can store custom key-value (KV) data in the user's browser and pass it to Google Ad Manager using the following API:
if (window.BIDDINGSTACK) {
window.BIDDINGSTACK.api.setGAMTargeting(key, value)
}
For example:
if (window.BIDDINGSTACK) {
window.BIDDINGSTACK.api.setGAMTargeting("audience_seg", ["Sports", "Shopping"])
}
// or
if (window.BIDDINGSTACK) {
window.BIDDINGSTACK.api.setGAMTargeting("audience_seg", "Sports")
}
// or remove the KV
if (window.BIDDINGSTACK) {
window.BIDDINGSTACK.api.setGAMTargeting("audience_seg", null)
}
In this example:
"audience_seg"
with your desired key.["Sports", "Shopping"]
represents an array of values associated with the key.