I have integrated prebid into our website with multiple adaptors, and it’s working fine, but when non-of the adaptors respond or get win I am seeing ‘House Ad’ banner instead, can I configure the prebid to show nothing in placeholder div (display: none) ?
more clarity:
We have integrated prebid in our website, where multiple add slots are present between contents. when non-of the adaptors respond with an ad or any other reason the ad is not present, there is a bordered ‘House Ad’ shows up (refer above image), which doesn’t serve any purpose to viewer (it is useful for debugging but not for user) now is there anyway that we can hide this ‘House Ad’ banner on production.
this scenario can be reproduced on jsfiddle after hard reloading few times
SCRIPT
var div_1_sizes = [ [300, 250], [300, 600] ]; var div_2_sizes = [ [728, 90], [970, 250] ]; var PREBID_TIMEOUT = 1000; var FAILSAFE_TIMEOUT = 3000; var adUnits = [ { code: '/19968336/header-bid-tag-0', mediaTypes: { banner: { sizes: div_1_sizes } }, bids: [{ bidder: 'appnexus', params: { placementId: 13144370 } }] }, { code: '/19968336/header-bid-tag-1', mediaTypes: { banner: { sizes: div_2_sizes } }, bids: [{ bidder: 'appnexus', params: { placementId: 13144370 } }] } ]; // ======== DO NOT EDIT BELOW THIS LINE =========== // var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; googletag.cmd.push(function() { googletag.pubads().disableInitialLoad(); }); var pbjs = pbjs || {}; pbjs.que = pbjs.que || []; pbjs.que.push(function() { pbjs.addAdUnits(adUnits); pbjs.requestBids({ bidsBackHandler: initAdserver, timeout: PREBID_TIMEOUT }); }); function initAdserver() { if (pbjs.initAdserverSet) return; pbjs.initAdserverSet = true; googletag.cmd.push(function() { pbjs.que.push(function() { pbjs.setTargetingForGPTAsync(); googletag.pubads().refresh(); }); }); } // in case PBJS doesn't load setTimeout(function() { initAdserver(); }, FAILSAFE_TIMEOUT); googletag.cmd.push(function() { googletag.defineSlot('/19968336/header-bid-tag-0', div_1_sizes, 'div-1').addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); googletag.cmd.push(function() { googletag.defineSlot('/19968336/header-bid-tag-1', div_2_sizes, 'div-2').addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); });
HTML
<h2>Basic Prebid.js Example</h2> <h5>Div-1</h5> <div id='div-1'> <script type='text/javascript'> googletag.cmd.push(function() { googletag.display('div-1'); }); </script> </div> <br> <p> some content</p> <p> some content</p> <h5>Div-2</h5> <div id='div-2'> <script type='text/javascript'> googletag.cmd.push(function() { googletag.display('div-2'); }); </script> </div> <p> some content</p> <p> some content</p>
Advertisement
Answer
In your case, here is what happens :
- page loads
- adserver & prebid are launched
- if no prebid line item selected, then adserver will select any “house ad” priority line item to fill the slot in.
Rather than hidding the house ads (you will still count impressions for these line items but users won’t be able to see it => bad practice), I would recommend you to :
- stop all House Ads line items from delivering in your Google Ad Manager UI (details here)
- enable the GPT “collapseEmptydiv” option (details here) so slots would collapse if none line item selected
Last : you could optimize your GPT script by grouping your adrequests (you are currently running 2 requests whereas you are using the SRA – Single Request Architecture – see here for details) :
googletag.cmd.push(function() { googletag.defineSlot('/19968336/header-bid-tag-0', div_1_sizes, 'div-1').addService(googletag.pubads()); googletag.defineSlot('/19968336/header-bid-tag-1', div_2_sizes, 'div-2').addService(googletag.pubads()); //collapse slots that are unable to be filled with an ad (no house ads) googletag.pubads().collapseEmptyDivs(); googletag.pubads().enableSingleRequest(); googletag.enableServices(); });