Skip to content

Commit 3962a9f

Browse files
author
mxklb
committed
Corrected ga code according to new eu law
1 parent 82d2a23 commit 3962a9f

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

js/ga.js

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
1+
var gaProperty = 'UA-64951930-1';
2+
var disableStr = 'ga-disable-' + gaProperty;
3+
if (document.cookie.indexOf(disableStr + '=true') > -1) {
4+
window[disableStr] = true;
5+
}
6+
function gaOptout() {
7+
document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
8+
window[disableStr] = true;
9+
alert('Das Tracking ist jetzt deaktiviert');
10+
}
11+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
12+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
313
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
4-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
14+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
515

6-
ga('create', 'UA-64951930-1', 'auto');
7-
ga('send', 'pageview');
16+
ga('create', 'UA-64951930-1', 'auto');
17+
ga('set', 'anonymizeIp', true);
18+
ga('send', 'pageview');

0 commit comments

Comments
 (0)