Tagged: google analytics, Tracking Code
Hey Kriesi Team,
it’s been a while since I last “bothered” you.
Data privacy is an important topic. I recently run into a thing, which I did not cover before and actually don’t know how to handle it.
In your theme options you provide a field for a Google Analytics tracking code. This is very comfortable, but it does’t allow me to make changes to the actual script.
Here’s what I would like to achieve:
ga('create', 'UA-XXXXXXXX-X', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
<script>
var gaProperty = 'UA-XXXXXXX-X';
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>
How can I achieve this?
Hopefully you can help me here.
Best wishes,
Andreas
Hey andreasobermeier,
Within the theme the Google Analytics Tracking Code box allows for your full script and code.
Best regards,
Mike
Hi Mike,
thanks for the fast reply. That works.
Thank you and best wishes,
Andreas