Skip to content

Commit 328b487

Browse files
author
codechair
committed
adding disable ga
1 parent 6881aab commit 328b487

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

disable-ga.html

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<html>
2+
3+
<head>
4+
5+
<meta name="robots" content="noindex, nofollow">
6+
7+
<script>
8+
9+
// Set to the same value as the web property used on the site
10+
11+
var gaProperty = 'UA-XXX-X';
12+
13+
14+
15+
// Disable tracking if the opt-out cookie exists.
16+
17+
var disableStr = 'ga-disable-' + gaProperty;
18+
19+
if (document.cookie.indexOf(disableStr + '=true') > -1) {
20+
21+
window[disableStr] = true;
22+
23+
}
24+
25+
26+
27+
// Opt-out function
28+
29+
function gaOptout() {
30+
31+
document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
32+
33+
window[disableStr] = true;
34+
35+
}
36+
37+
</script>
38+
39+
</head>
40+
41+
<body>
42+
43+
Don't do anything here unless instructed to by a dev (aka Pat).
44+
45+
<br>
46+
47+
<a onclick="alert('Google Analytics Tracking is now deactivated');" href="javascript:gaOptout()">Click here to opt-out of Google Analytics</a>
48+
49+
</body>
50+
51+
</html>

0 commit comments

Comments
 (0)