1111 const adUnits = [ {
1212 mediaTypes : {
1313 banner : {
14- sizes : [ 600 , 500 ]
14+ sizes : [ [ 320 , 250 ] , [ 300 , 250 ] ]
1515 }
1616 } ,
1717 code : adUnitCode ,
1818 bids : [
19- { bidder : 'testBidder' , params : { } }
19+ { bidder : 'testBidder' , params : { } } ,
20+ { bidder : 'kobler' , params : { test : true } } ,
2021 ]
21- } ]
22+ } ] ;
23+
24+ function requestBids ( ) {
25+ pbjs . requestBids ( {
26+ adUnitCodes : [ adUnitCode ] ,
27+ bidsBackHandler : function ( ) {
28+ const bids = pbjs . getHighestCpmBids ( adUnitCode ) ;
29+ const winningBid = bids [ 0 ] ;
30+ const div = document . getElementById ( 'banner' ) ;
31+ let iframe = div . querySelector ( 'iframe' )
32+ if ( iframe === null ) {
33+ iframe = document . createElement ( 'iframe' ) ;
34+ iframe . frameBorder = '0' ;
35+ div . appendChild ( iframe ) ;
36+ }
37+ var iframeDoc = iframe . contentWindow . document ;
38+ pbjs . renderAd ( iframeDoc , winningBid . adId ) ;
39+ }
40+ } ) ;
41+ }
42+
43+ function refreshBids ( ) {
44+ pbjs . que . push ( requestBids ) ;
45+ }
46+
47+ function refreshPageViewId ( ) {
48+ pbjs . que . push ( function ( ) {
49+ pbjs . refreshPageViewId ( )
50+ } ) ;
51+ }
2252
2353 pbjs . que . push ( function ( ) {
2454
55+ pbjs . setConfig ( {
56+ pageUrl : 'https://www.tv2.no/mening-og-analyse/14555348/'
57+ } )
58+
2559 /**
2660 * BID RESPONSE SIMULATION SECTION START
2761 *
5589 */
5690
5791 pbjs . addAdUnits ( adUnits ) ;
58- pbjs . requestBids ( {
59- adUnitCodes : [ adUnitCode ] ,
60- bidsBackHandler : function ( ) {
61- const bids = pbjs . getHighestCpmBids ( adUnitCode ) ;
62- const winningBid = bids [ 0 ] ;
63- const div = document . getElementById ( 'banner' ) ;
64- let iframe = document . createElement ( 'iframe' ) ;
65- iframe . frameBorder = '0' ;
66- div . appendChild ( iframe ) ;
67- var iframeDoc = iframe . contentWindow . document ;
68- pbjs . renderAd ( iframeDoc , winningBid . adId ) ;
69- }
70- } ) ;
92+ requestBids ( ) ;
7193 } ) ;
7294 </ script >
7395 </ head >
7496 < body >
7597 < h2 > Prebid Test Bidder Example</ h2 >
98+ < p > < button onclick ="refreshBids() "> Refresh Ad Units</ button > </ p >
99+ < p > < button onclick ="refreshPageViewId() "> Refresh page view ID</ button > </ p >
76100 < h5 > Banner ad</ h5 >
77101 < div id ="banner "> </ div >
78102 </ body >
79- </ html >
103+ </ html >
0 commit comments