forked from prebid/prebid.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathamazon_example2.html
More file actions
125 lines (93 loc) · 3.5 KB
/
Copy pathamazon_example2.html
File metadata and controls
125 lines (93 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<html>
<head>
<script>
var PREBID_TIMEOUT = 400;
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
function initAdserver() {
if (pbjs.initAdserverSet) return;
(function() {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') +
'//www.googletagservices.com/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);
})();
pbjs.initAdserverSet = true;
};
setTimeout(initAdserver, PREBID_TIMEOUT);
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
(function() {
var pbjsEl = document.createElement("script"); pbjsEl.type = "text/javascript";
pbjsEl.async = true;
pbjsEl.src = '//acdn.adnxs.com/prebid/prebid.js';
var pbjsTargetEl = document.getElementsByTagName("head")[0];
pbjsTargetEl.insertBefore(pbjsEl, pbjsTargetEl.firstChild);
})();
pbjs.que.push(function() {
var adUnits = [{
code: '/19968336/header-bid-tag-0',
sizes: [[300, 250], [300, 600]],
bids: [
// Add bids of a custom adaptor (in this case Amazon) to inform
// Prebid.js that it should call its adaptor (in this case A9Adaptor
// as below)
{
bidder: 'amazon'
},
{
bidder: 'appnexus',
params: {
placementId: '10433394'
}
}
]
}];
pbjs.addAdUnits(adUnits);
// A custom bidder adaptor
var A9Adaptor = function A9Adaptor() {
return {
callBids: function(p) {
pbjs.loadScript('//c.amazon-adsystem.com/aax2/amzn_ads.js', function() {
amznads.getAdsCallback('3030', function() {
// Indicate this bidder's bid is back here, so that Prebid.js can wait
// till this bid is back if all other bidders responded before the timeout.
pbjs.bidsAvailableForAdapter('amazon');
});
});
}
};
};
pbjs.registerBidAdapter(A9Adaptor, 'amazon');
pbjs.requestBids({
bidsBackHandler: function(bidResponses) {
initAdserver();
}
})
});
</script>
<script>
googletag.cmd.push(function() {
var rightSlot = googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1438287399331-0').addService(googletag.pubads());
pbjs.que.push(function() {
pbjs.setTargetingForGPTAsync();
// Set Amazon Targeting here together when you set targeting for other prebid bidders.
amznads.setTargetingForGPTAsync('amznslots');
});
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
</head>
<body style="padding:0;margin:0">
<div id='div-gpt-ad-1438287399331-0'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1438287399331-0'); });
</script>
</div>
</body>
</html>