forked from snowplow/snowplow-javascript-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcookies.html
More file actions
94 lines (83 loc) · 3.03 KB
/
Copy pathcookies.html
File metadata and controls
94 lines (83 loc) · 3.03 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Cookies test page</title>
</head>
<body style="width: 2000px; height: 2000px; position: relative">
<div id="init"></div>
<div id="cookies"></div>
<div id="getDomainUserId"></div>
<div id="getDomainUserInfo"></div>
<div id="getUserId"></div>
<div id="getCookieName"></div>
<div id="getPageViewId"></div>
<script>
(function (p, l, o, w, i, n, g) {
if (!p[i]) {
p.GlobalSnowplowNamespace = p.GlobalSnowplowNamespace || [];
p.GlobalSnowplowNamespace.push(i);
p[i] = function () {
(p[i].q = p[i].q || []).push(arguments);
};
p[i].q = p[i].q || [];
n = l.createElement(o);
g = l.getElementsByTagName(o)[0];
n.async = 1;
n.src = w;
g.parentNode.insertBefore(n, g);
}
})(window, document, 'script', './snowplow.js', 'snowplow');
snowplow('newTracker', 'sp0', 'snowplow-js-tracker.local:9090', {
cookieName: '_sp_0',
});
snowplow('newTracker', 'sp1', 'snowplow-js-tracker.local:9090', {
cookieName: '_sp_1',
cookieSecure: false,
});
snowplow('setUserId:sp1', 'Dave');
snowplow('newTracker', 'sp2', 'snowplow-js-tracker.local:9090', {
cookieName: '_sp_2',
cookieSameSite: 'Strict',
cookieSecure: false,
cookieLifetime: 604800,
});
snowplow('newTracker', 'sp3', 'snowplow-js-tracker.local:9090', {
cookieName: '_sp_3',
cookieSecure: false,
sessionCookieTimeout: 1,
cookieLifetime: 1,
});
snowplow('newTracker', 'sp4', 'snowplow-js-tracker.local:9090', {
cookieName: '_sp_4',
cookieSecure: false,
anonymousTracking: true,
});
snowplow('newTracker', 'sp5', 'snowplow-js-tracker.local:9090', {
cookieName: '_sp_5',
cookieSecure: false,
stateStorageStrategy: 'localStorage',
});
snowplow('newTracker', 'sp6', 'snowplow-js-tracker.local:9090', {
cookieName: '_sp_6',
cookieSecure: false,
stateStorageStrategy: 'cookie',
});
snowplow('newTracker', 'sp7', 'snowplow-js-tracker.local:9090', {
cookieName: '_sp_7',
cookieSecure: false,
cookieDomain: '.google.com',
});
snowplow(function () {
document.getElementById('init').innerText = 'true';
document.getElementById('getDomainUserId').innerText = this.sp1.getDomainUserId();
document.getElementById('getDomainUserInfo').innerText = this.sp1.getDomainUserInfo();
document.getElementById('getUserId').innerText = this.sp1.getUserId();
document.getElementById('getCookieName').innerText = this.sp1.getCookieName('id');
document.getElementById('getPageViewId').innerText = this.sp1.getPageViewId();
});
setTimeout(function () {
document.getElementById('cookies').innerText = document.cookie;
}, 3000); // Wait 3 seconds so sp3 cookies expires
</script>
</body>
</html>