-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
97 lines (87 loc) · 2.62 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Prebid Video Renderer</title>
<script src="/dist/prebid-video-renderer.js"></script>
<script async src="//www.googletagservices.com/tag/js/gpt.js"></script>
<script src="//cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js"></script>
<script>
const adContainerSizes = [
[1, 1],
];
const PREBID_TIMEOUT = 3000;
const FAILSAFE_TIMEOUT = 3500;
const adUnits = [
{
code: '/19968336/prebid_outstream_adunit_1',
mediaTypes: {
video: {
context: 'outstream',
playerSize: [640, 390],
mimes: ['video/mp4'],
protocols: [1, 2, 3, 4, 5, 6, 7, 8],
playbackmethod: [2],
skip: 1,
useCacheKey: true,
}
},
bids: [
{
bidder: 'appnexus',
params: {
placementId: 13232385,
},
},
]
},
];
const googletag = window.googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
googletag.pubads().disableInitialLoad();
});
const pbjs = window.pbjs || {};
pbjs.que = pbjs.que || [];
pbjs.que.push(function() {
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: initAdserver,
timeout: PREBID_TIMEOUT
});
});
function initAdserver(bids) {
if (pbjs.initAdserverSet) return;
pbjs.initAdserverSet = true;
googletag.cmd.push(function() {
pbjs.que.push(function() {
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
});
}
// in case PBJS doesn't load
setTimeout(function() {
initAdserver();
}, FAILSAFE_TIMEOUT);
googletag.cmd.push(function() {
googletag.defineSlot('/19968336/prebid_outstream_adunit_1', adContainerSizes, 'adContainer').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
</head>
<body>
<div id="app">
<h1>Prebid Video Renderer</h1>
<div id="adContainer" style="width: 300px; height: 250px;">
<script type="text/javascript">
googletag.cmd.push(function() {
googletag.display("adContainer");
});
</script>
</div>
</div>
</body>
</html>