To start HB auction, just add the call to Pubstack Instream Integration providing the divId configured on your ad unit, and that must be present in the DOM.
Based on which player you’re using, you could need to run this code before the initialization of the player, and use the targetings
object to prepare the correct configuration.
A generic example:
kleanads = window.kleanads || { cmd: [] }
window.kleanads = kleanads
window.kleanads.cmd.push(() => {
// call the monetize function with the div id of the ad unit
window.kleanads.monetize('video-player')
.then((targetings) => {
/* targetings is an object that contains all keys and values to use
* {
* adm: "1",
* amznbid: "1shi0d2",
* bid_id: "951e35a6kgd8eh9",
* ...
* }
// < your player configuration here >
*/
})
.catch((error) => {
// error is a "string" with a small description of the error
// < you fallback code here >
})
});
The monetize()
function returns a targetings
object containing all key-values from the header bidding auction. These keys are required for Google Ad Manager to correctly select and deliver the winning ad.
No matter which video player you are using, these targeting keys must be passed into the cust_params
parameter of the ad request made through the Google IMA SDK.
Without cust_params
, GAM will not receive the targeting information and your instream ads may not be served as expected.
✅ In Network (chrome dev tools)→ filter on gampad/ads? and check the cust_params
field contains the keys/values (URL-encoded) returned by kleanads.monetize()
.
📚Refer to Google's doc: Vast ad tag parameters-,cust_params,-(Custom%20parameters)) IMA SDK