-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisable-ga.html
More file actions
51 lines (24 loc) · 793 Bytes
/
disable-ga.html
File metadata and controls
51 lines (24 loc) · 793 Bytes
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
<html>
<head>
<meta name="robots" content="noindex, nofollow">
<script>
// Set to the same value as the web property used on the site
var gaProperty = 'UA-XXX-X';
// Disable tracking if the opt-out cookie exists.
var disableStr = 'ga-disable-' + gaProperty;
if (document.cookie.indexOf(disableStr + '=true') > -1) {
window[disableStr] = true;
}
// Opt-out function
function gaOptout() {
document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
window[disableStr] = true;
}
</script>
</head>
<body>
Don't do anything here unless instructed to by a dev (aka Pat).
<br>
<a onclick="alert('Google Analytics Tracking is now deactivated');" href="javascript:gaOptout()">Click here to opt-out of Google Analytics</a>
</body>
</html>