UNPKG

mk9-prebid

Version:

Header Bidding Management Library

133 lines (120 loc) 3.15 kB
<html> <head> <script async src="../../build/dist/prebid.js"></script> <script async src="https://www.googletagservices.com/tag/js/gpt.js"></script> <script> var PREBID_TIMEOUT = 5000; var adUnits = [{ code: 'div-gpt-ad-1460505748561-0', mediaTypes: { banner: { sizes: [[300, 250], [300, 600]], } }, // Replace this object to test a new Adapter! bids: [{ bidder: 'appnexus', params: { placementId: 13144370 } }] }, { code: '/19968336/prebid_native_example_2', sizes: [ [1, 1] ], mediaTypes: { native: { title: { required: true }, body: { required: true }, image: { required: true }, sponsoredBy: { required: true }, icon: { required: false }, } }, bids: [{ bidder: 'appnexus', params: { placementId: 13232354, allowSmallerSizes: true } }] }]; var pbjs = pbjs || {}; pbjs.que = pbjs.que || []; </script> <script> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; const customPriceGranularity = { "buckets": [{ "precision": 2, //default is 2 if omitted - means 2.1234 rounded to 2 decimal places = 2.12 "min": 0, "max": 5, "increment": 0.01 // from $0 to $5, 1-cent increments }, { "precision": 2, "min": 5, "max": 8, "increment": 0.05 // from $5 to $8, round down to the previous 5-cent increment }, { "precision": 2, "min": 8, "max": 40, "increment": 0.5 // from $8 to $40, round down to the previous 50-cent increment }] }; googletag.cmd.push(function () { googletag.pubads().disableInitialLoad(); }); pbjs.que.push(function () { pbjs.addAdUnits(adUnits); pbjs.setConfig({ priceGranularity: customPriceGranularity }); pbjs.requestBids({ bidsBackHandler: sendAdserverRequest, timeout: PREBID_TIMEOUT }); }); function sendAdserverRequest() { if (pbjs.adserverRequestSent) return; pbjs.adserverRequestSent = true; googletag.cmd.push(function () { pbjs.que.push(function () { pbjs.setTargetingForGPTAsync(); googletag.pubads().refresh(); }); }); } </script> <script> googletag.cmd.push(function () { googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); </script> </head> <body> <h2>Prebid.js Test</h2> <h5>Div-1</h5> <div id='div-gpt-ad-1460505748561-0'> <script type='text/javascript'> googletag.cmd.push(function () { googletag.display('div-gpt-ad-1460505748561-0'); }); </script> </div> </body> </html>