Problem with Google analytics disabling
Hallo,
I have web site(Contao 3.5) with active google analytics. Now, my customer want button which can disable analytics.
I found solution for Contao: https://erdmann-freunde.de/logbuch/a...o-datenschutz/
but for me not work.
Therefore, I changed analytics_google.html5 file and imported next code:
HTML Code:
<script>
var gaProperty = '<?php echo $GoogleAnalyticsId; ?>';
var disableStr = 'ga-disable-' + gaProperty;
if (document.cookie.indexOf(disableStr + '=true') > -1) {
window[disableStr] = true;
}
function gaOptout() {
document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
window[disableStr] = true;
}
</script>
Also, I created link with HTML element:
HTML Code:
<a href="javascript:gaOptout()">Google Analytics deaktivieren</a>
On click, nothing's happening, analytics is still active.
I tired with new Contao 4.7, but still not work.
Maybe somebody had same problem,...,solution?
Thank you in advanced