-
Notifications
You must be signed in to change notification settings - Fork 1
/
standard_gpt.html
89 lines (80 loc) · 3.39 KB
/
standard_gpt.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
<html lang="en-us">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<style type="text/css" media="screen">
</style>
<script type='text/javascript'>
var rubicontag = rubicontag || {};
rubicontag.cmd = rubicontag.cmd || [];
var gptadslots = [];
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
// replace '<account_id>' with your rubicon project account id number a test account is used for demo purposes
var account_id = 14062;
var rct = document.createElement('script');
rct.type = 'text/javascript'
rct.async = true;
rct.src = (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//ads.rubiconproject.com/header/' + account_id + '.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.appendChild(rct);
})();
</script>
<script type='text/javascript'>
rubicontag.cmd.push(function() {
// replace '/112115922/FLPT-728x90' with a unique string typically matches DFP ad unit name/path
// replace [728,90] with an array of dimensions of the given slot
// multiple sizes can be passed into a single slot by passing in the size dimensions as an array
rubicontag.defineSlot('/112115922/FLPT-728x90', [[728,90], [970,250]], 'fastlane-lb-div');
rubicontag.defineSlot('/112115922/FLPT-300x250', [[728,90]], 'fastlane-mpu-div');
rubicontag.addKW('fastlane');
// run rubicontag
rubicontag.run(gptrun);
});
googletag.cmd.push(function() {
// define your GPT slots
// replace '112115922' with your DFP network id
// replace 'FLPT-728x90' with your DFP ad unit name/path
// replace [728, 90] with ad unit width and height
// replace 'fastlane-lb-div with the unique ad unit div id for the element where the ad should render
gptadslots[0] = googletag.defineSlot('/112115922/FLPT-728x90', [[728, 90], [970,250]], 'fastlane-lb-div').addService(googletag.pubads());
// Adding new slot
// gptadslots[1] = googletag.defineSlot('/112115922/FLPT-300x250', [[300, 250]], 'fastlane-mpu-div').addService(googletag.pubads());
// set rubicon targeting
for (var i=0; i<gptadslots.length; i++) {
rubicontag.setTargetingForGPTSlot(gptadslots[i]);
};
googletag.pubads().enableSingleRequest();
googletag.pubads().enableAsyncRendering();
googletag.enableServices();
});
var gptran = false;
var gptrun = function() {
// don't run again if already ran
if (gptran) {
return;
}
gptran = true;
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);
};
// fail-safe to load gpt.js if fastlane doesn’t load or gptrun() callback is just never called
setTimeout(gptrun, 1000);
</script>
</head>
<body>
<!--// replace '<ad-unit-div-id'> with a unique ad unit div id (.defineSlot & .display should match this) //-->
<div id='fastlane-lb-div'>
<script type='text/javascript'>
// replace '<ad-unit-div-id'> with the unique ad unit div id for the element where the ad should render
googletag.cmd.push(function() { googletag.display('fastlane-lb-div'); });
</script>
</div>
</div>
</body>
</html>