-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
115 lines (110 loc) · 3.6 KB
/
index.html
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
<html>
<head>
<title>Individual Ad Unit Refresh Example</title>
<script async src="//www.googletagservices.com/tag/js/gpt.js"></script>
<script async src="//acdn.adnxs.com/prebid/not-for-prod/1/prebid.js"></script>
<script>
var sizes = [
[300, 250]
];
var PREBID_TIMEOUT = 1000;
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
googletag.cmd.push(function() {
googletag.pubads().disableInitialLoad();
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
var adUnit = {
mediaTypes: {
banner: {
sizes: sizes
}
},
bids: [
{
bidder: 'appnexus',
params: {
placementId: '5823281'
}
},
{
bidder: 'appnexus',
params: {
placementId: '5823300',
},
},
{
bidder: 'appnexus',
params: {
placementId: '5823309',
},
},
{
bidder: 'rubicon',
params: {
accountId: '14288',
siteId: '189902',
zoneId: '943458',
},
},
{
bidder: 'conversant',
params: {
site_id: '119315',
bidfloor: 0,
secure: 0,
},
}]
};
var adUnits = [];
for (var i = 1; i < 6; i++) {
var unit = adUnit;
unit.code = `div-${i}`;
adUnits.push(unit);
}
pbjs.que.push(function() {
pbjs.addAdUnits(adUnits);
});
function refreshBid(slot, slotName) {
pbjs.que.push(function() {
pbjs.requestBids({
timeout: PREBID_TIMEOUT,
adUnitCodes: [slotName],
bidsBackHandler: function() {
pbjs.setTargetingForGPTAsync([slotName]);
googletag.pubads().refresh([slot]);
}
});
});
}
</script>
</head>
<body>
<h1>Individual Ad Unit Refresh Example</h1>
<h5>Div-1</h5>
<div id='div-1'>
<script>
googletag.cmd.push(function() {
slot1 = googletag.defineSlot('/188641797/test', [[300, 250]], 'div-1')
slot1.addService(googletag.pubads());
googletag.display('div-1');
refreshBid(slot1, 'div-1');
});
</script>
</div>
<h5>Div-2</h5>
<div id='div-2'>
<script>
googletag.cmd.push(function() {
slot1 = googletag.defineSlot('/188641797/test', [[300, 250]], 'div-2')
slot1.addService(googletag.pubads());
googletag.display('div-2');
refreshBid(slot1, 'div-2');
});
</script>
</div>
</body>
</html>