-
Notifications
You must be signed in to change notification settings - Fork 1
/
first_party_data_page_gpt.html
83 lines (74 loc) · 3.09 KB
/
first_party_data_page_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
<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 || [];
</script>
<!--Replace '14062' with your rubicon project account id number a test account is used for demo purposes-->
<script type="text/javascript" src="http://ads.rubiconproject.com/header/14062.js"></script>
<script type='text/javascript'>
rubicontag.cmd.push(function() {
// set slot level keyword (addKW), first party visitor (FPV) and/or inventory (FPI) data
rubicontag.defineSlot('/112115922/FLPT-728x90', [[728,90]], 'fastlane-lb-div');
// set page level context, e.g. mobile
rubicontag.addContext('mobile');
// set global keyword (addKW), first party visitor (FPV) and/or inventory (FPI) data
// replace 'Fastlane' with your keyword
// replace 'interests or section' with your key name and 'sports or homepage' with your single value.
// all can be called multiple times
rubicontag.addKW('Fastlane');
rubicontag.setFPV('interests', ['sports']);
rubicontag.setFPI('section',['homepage']);
// 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]], 'fastlane-lb-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>
</body>
</html>