-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Copy pathblueconicRtdProvider_example.html
121 lines (104 loc) · 3.54 KB
/
blueconicRtdProvider_example.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
116
117
118
119
120
121
<html>
<head>
<script>
var testBlueconicData = `{"segment": [{"id": "176753"}], "ext": {"segtax":"123"}, "bidId": "1234", "identifier": ["test","123"]}`;
window.localStorage.setItem('bcPrebidData', testBlueconicData);
</script>
<script>
var FAILSAFE_TIMEOUT = 2000;
var adUnits = [
{
code: 'test-div',
mediaTypes: {
banner: {
sizes: [[300,250],[300,600],[728,90]]
}
},
bids: [
{
bidder: 'appnexus',
params: {
placementId: 13144370
}
}
]
}
];
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
</script>
<script src="https://cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js" async></script>
<script>
var googletag = googletag || {};
var testAuctionDelay = 2000;
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
googletag.pubads().disableInitialLoad();
});
pbjs.que.push(function() {
pbjs.setConfig({
debug: true,
realTimeData: {
auctionDelay: testAuctionDelay, // lower in real scenario to meet publisher spec
dataProviders: [
{
name: "blueconic",
waitForIt: true,
params: {
requestParams: {
publisherId: 0,
coppa: true
}
}
}
]
}
});
pbjs.addAdUnits(adUnits);
pbjs.requestBids({bidsBackHandler: sendAdserverRequest});
});
function sendAdserverRequest() {
document.getElementById('blueconic_data').innerHTML = window.localStorage.getItem('bcPrebidData');
if (pbjs.adserverRequestSent) return;
pbjs.adserverRequestSent = true;
googletag.cmd.push(function() {
pbjs.que.push(function() {
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
});
}
setTimeout(function() {
sendAdserverRequest();
}, FAILSAFE_TIMEOUT);
</script>
<script>
(function () {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
gads.src = 'https://securepubads.g.doubleclick.net/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);
})();
</script>
<script>
googletag.cmd.push(function() {
googletag.defineSlot('/112115922/FL_PB_MedRect', [[300, 250],[300,600]], 'test-div').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
</head>
<body>
<h2>BlueConic RTD Prebid</h2>
<div id='test-div'>
<script>
googletag.cmd.push(function() { googletag.display('test-div'); });
</script>
</div>
BlueConic Real-Time Data:
<div id='blueconic_data'>
</div>
</body>
</html>