Javascript API

Setup and pass page level KV pairs for Google Ad Manager

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',
})

Disable advertising on a specific URL:

You can use the following API to disable the advertising on a URL:

window.dataLayer = window.dataLayer || []
dataLayer.push({
  event: 'bs.targeting',
  articleType: 'noads',
})

Teardown and bootstrap the ad engine with API

if (window.BIDDINGSTACK) {
  window.BIDDINGSTACK.api.teardown()
  window.BIDDINGSTACK.api.bootstrap()
}

Discover new ad slots on the page

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()
}