|
5 | 5 | <script async src="//www.googletagservices.com/tag/js/gpt.js"></script>
|
6 | 6 | <script type="text/javascript" src="../../build/dev/prebid.js" async></script>
|
7 | 7 | <script>
|
8 |
| - var sizes = [ |
9 |
| - [300, 250], |
10 |
| - [250, 300], |
11 |
| - [300, 600] |
12 |
| - ]; |
13 |
| - var PREBID_TIMEOUT = 3000; |
14 |
| - var FAILSAFE_TIMEOUT = 3000; |
| 8 | + const sizes = [ |
| 9 | + [300, 250], |
| 10 | + [250, 300], |
| 11 | + [300, 600] |
| 12 | + ]; |
| 13 | + const PREBID_TIMEOUT = 3000; |
| 14 | + const FAILSAFE_TIMEOUT = 3000; |
15 | 15 |
|
16 |
| - var adUnits = [{ |
17 |
| - code: '/19968336/header-bid-tag-1', |
18 |
| - mediaTypes: { |
19 |
| - banner: { |
20 |
| - sizes: sizes |
21 |
| - } |
22 |
| - }, |
23 |
| - bids: [{ |
24 |
| - bidder: 'emoteev', |
25 |
| - params: { |
26 |
| - adSpaceId: 5084, |
27 |
| - } |
28 |
| - }] |
29 |
| - }]; |
| 16 | + const adUnits = [{ |
| 17 | + code: '/19968336/header-bid-tag-1', |
| 18 | + mediaTypes: { |
| 19 | + banner: { |
| 20 | + sizes: sizes |
| 21 | + } |
| 22 | + }, |
| 23 | + bids: [{ |
| 24 | + bidder: 'emoteev', |
| 25 | + params: { |
| 26 | + adSpaceId: 5084, |
| 27 | + } |
| 28 | + }] |
| 29 | + }]; |
30 | 30 |
|
31 |
| - // ======== DO NOT EDIT BELOW THIS LINE =========== // |
32 |
| - var googletag = googletag || {}; |
33 |
| - googletag.cmd = googletag.cmd || []; |
34 |
| - googletag.cmd.push(function () { |
35 |
| - googletag.pubads().disableInitialLoad(); |
36 |
| - }); |
| 31 | + // ======== DO NOT EDIT BELOW THIS LINE =========== // |
| 32 | + var googletag = googletag || {}; |
| 33 | + googletag.cmd = googletag.cmd || []; |
| 34 | + googletag.cmd.push(function () { |
| 35 | + googletag.pubads().disableInitialLoad(); |
| 36 | + }); |
37 | 37 |
|
38 |
| - var pbjs = pbjs || {}; |
39 |
| - pbjs.que = pbjs.que || []; |
| 38 | + var pbjs = pbjs || {}; |
| 39 | + pbjs.que = pbjs.que || []; |
40 | 40 |
|
41 |
| - pbjs.que.push(function () { |
42 |
| - pbjs.addAdUnits(adUnits); |
43 |
| - pbjs.requestBids({ |
44 |
| - bidsBackHandler: initAdserver, |
45 |
| - timeout: PREBID_TIMEOUT |
46 |
| - }); |
| 41 | + pbjs.que.push(function () { |
| 42 | + pbjs.addAdUnits(adUnits); |
| 43 | + pbjs.requestBids({ |
| 44 | + bidsBackHandler: initAdserver, |
| 45 | + timeout: PREBID_TIMEOUT |
47 | 46 | });
|
| 47 | + }); |
48 | 48 |
|
49 |
| - function initAdserver() { |
50 |
| - if (pbjs.initAdserverSet) return; |
51 |
| - pbjs.initAdserverSet = true; |
52 |
| - googletag.cmd.push(function () { |
53 |
| - pbjs.que.push(function () { |
54 |
| - pbjs.setTargetingForGPTAsync(); |
55 |
| - googletag.pubads().refresh(); |
56 |
| - }); |
57 |
| - }); |
58 |
| - } |
59 |
| - |
60 |
| - |
61 |
| - // in case PBJS doesn't load |
62 |
| - setTimeout(function () { |
63 |
| - console.log("prebid.js setTimeout"); |
64 |
| - initAdserver(); |
65 |
| - }, FAILSAFE_TIMEOUT); |
66 |
| - |
| 49 | + function initAdserver() { |
| 50 | + if (pbjs.initAdserverSet) return; |
| 51 | + pbjs.initAdserverSet = true; |
67 | 52 | googletag.cmd.push(function () {
|
68 |
| - googletag.defineSlot('/19968336/header-bid-tag-1', sizes, 'div-1') |
69 |
| - .addService(googletag.pubads()); |
70 |
| - googletag.pubads().enableSingleRequest(); |
71 |
| - googletag.enableServices(); |
| 53 | + pbjs.que.push(function () { |
| 54 | + pbjs.setTargetingForGPTAsync(); |
| 55 | + googletag.pubads().refresh(); |
| 56 | + }); |
72 | 57 | });
|
| 58 | + } |
73 | 59 |
|
74 |
| - </script> |
| 60 | + setTimeout(function () { |
| 61 | + initAdserver(); |
| 62 | + }, FAILSAFE_TIMEOUT); |
75 | 63 |
|
| 64 | + googletag.cmd.push(function () { |
| 65 | + googletag.defineSlot('/19968336/header-bid-tag-1', sizes, 'div-1') |
| 66 | + .addService(googletag.pubads()); |
| 67 | + googletag.pubads().enableSingleRequest(); |
| 68 | + googletag.enableServices(); |
| 69 | + }); |
| 70 | + </script> |
76 | 71 | </head>
|
77 | 72 |
|
78 | 73 | <body>
|
79 | 74 | <h2>Basic Prebid.js Example</h2>
|
80 | 75 | <h5>Div-1</h5>
|
81 | 76 | <div id='div-1'>
|
82 | 77 | <script type='text/javascript'>
|
83 |
| - googletag.cmd.push(function () { |
84 |
| - googletag.display('div-1'); |
85 |
| - }); |
| 78 | + googletag.cmd.push(function () { |
| 79 | + googletag.display('div-1'); |
| 80 | + }); |
86 | 81 |
|
87 | 82 | </script>
|
88 | 83 | </div>
|
|
0 commit comments