I've implemented a Prebid auction integrated to admanager with refresh adv after 30seconds using the official function listed here:
https://docs.prebid.org/dev-docs/examples/adunit-refresh.html
Here the code used:
CONFIG
pbjs.setConfig({
debug: PREBID_DEBUG,
enableSendAllBids: true,
useBidCache: true,
bidderTimeout: BIDDER_TIMEOUT,
consentManagement: iabConfig,
});
The refresing code:
function refreshBid(slot,adUnit){
console.log("refreshBid auction");
pbjs.que.push(function() {
pbjs.requestBids({
timeout: BIDDER_TIMEOUT,
adUnitCodes: [slot],
bidsBackHandler: function() {
pbjs.setTargetingForGPTAsync([slot]);
googletag.pubads().refresh([adUnit]);
}
});
});
}
function refreshADV(){
console.log("refresh adv...");
var slots=[];
googletag.cmd.push(function() {
googletag.pubads().getSlots().forEach(function(e){
if(e.getAdUnitPath().includes("FloorAd") || e.getAdUnitPath().includes("Sticky")){
console.log(e.getSlotElementId());
//Refresh bid...
refreshBid(e.getSlotElementId(), e); // slot,adUnit
}
});
});
}
setInterval(function(){ refreshADV(); }, 30000);//30ec
The refresh is applied only in 2 adv (Floor and Sticky ) and i see the refresh on screen.
We see this discrepancies on numbers (only on those refreshing position):
AdForm: we see on admanager 522 impression ed € 0,31 - 217 impression ed € 0,13 in SSP
AppNexus: we see on admanager 2.876 impression ed € 0,39 - 231 impression ed € 0,06 in SSP
the auction restart correctly after 30 sec (i see this on console debug).
any advice for us?