-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoh_ga.js
36 lines (31 loc) · 1.21 KB
/
toh_ga.js
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
(function () {
if(typeof prebid_ga_status !== "undefined" && prebid_ga_status == 1) {
if(toh_debug) {
console.log("prebid_ga_status in ad wrapper: "+prebid_ga_status);
}
var dateObj = new Date(),
year = dateObj.getUTCFullYear(),
month = dateObj.getUTCMonth() + 1,
day = dateObj.getUTCDate(),
hrs = dateObj.getUTCHours()-4,
min = dateObj.getUTCMinutes(),
sec = dateObj.getUTCSeconds();
var curNewYorkTime = year+"/"+month+"/"+day+" "+hrs+":"+min+":"+sec;
var checkNewYorkStartTime = year+"/"+month+"/"+day+" 13:"+min+":"+sec;
var checkNewYorkEndTime = year+"/"+month+"/"+day+" 15:"+min+":"+sec;
// Added analytics code for prebid
// Add the below code snippet to your page
pbjs.que.push(function() {
if(Date.parse(curNewYorkTime) >= Date.parse(checkNewYorkStartTime) && Date.parse(curNewYorkTime) <= Date.parse(checkNewYorkEndTime)) {
pbjs.enableAnalytics({
provider: 'ga',
options: {
global: 'ga', // <string> name of GA global. Default is 'ga'
trackerName: 'adWrapperTracker',
enableDistribution: false,
}
});
}
});
}
})();