| layout | example | |||
|---|---|---|---|---|
| title | Basic Example | |||
| left_nav_override | Examples | |||
| description | Basic Prebid.js Example | |||
| sidebarType | 1 | |||
| about |
|
|||
| pid | 10 |
{% capture htmlCodePrebid %}
<script src="/asset?url=https%3A%2F%2Fgithub.com%2FStackAdapt%2Fprebid.github.io%2Fblob%2Fmaster%2Fdev-docs%2Fexamples%2Fintercept-banner-not-for-prod.js" ></script>{% capture jsCode %} var sizes = [ [300, 250] ]; var PREBID_TIMEOUT = 700;
var adUnits = [{ code: '/19968336/header-bid-tag-1', mediaTypes: { banner: { sizes: sizes } }, bids: [{ bidder: 'appnexus', params: { placementId: 'XXXXXXX' //not used in prod } }] }];
// ======== 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 }); });
function initAdserver() { if (pbjs.initAdserverSet) return; pbjs.initAdserverSet = true; googletag.cmd.push(function() { if (pbjs.libLoaded) { pbjs.que.push(function() { pbjs.setTargetingForGPTAsync(); googletag.pubads().refresh(); }); } else { googletag.pubads().refresh(); } }); }
setTimeout(function() { initAdserver(); }, PREBID_TIMEOUT);
googletag.cmd.push(function() { googletag.defineSlot('/19968336/header-bid-tag-1', sizes, 'div-1') .addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); {% endcapture %}
{% include code/web-example.html id="basic-prebid-example" html=htmlCodePrebid js=jsCode scripts="pbjs,gpt" %}