-
AuthorPosts
-
April 21, 2016 at 4:03 pm #619229
Hi @ all,
I am currently struggling with the privacy-conform Google Analytics integration:
I have added the following code into the field “Google Analytics Tracking Code”:<script>
var gaProperty = ‘UA-XXXXXXXXX’;
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>
<script>
(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,’script’,’https://www.google-analytics.com/analytics.js’,’ga’);
ga(‘create’, ‘UA-XXXXXX’, ‘auto’);
ga(‘set’, ‘anonymizeIp’, true);
ga(‘send’, ‘pageview’);
</script>It should do the following:
1. Enable Google Analytics tracking
2. Anonymize the user IP
3. Offer an Opt-Out-OptionPoint 1 works, I am not sure about Point 2 and I definitely need help Point 3 ;-)
I need to integrate a link into my Privacy Statement, which the User can use to execute the opt-out logic. It should look somehow like that:
href=”gaOptout()”>Click here to opt-out of Google AnalyticsIf I insert this code as link to my text it is not possible to start the javascript…
Could you please tell me how I need to insert the Code into the privacy page so that the script will start?Thanks for your great help guys!
Best regards, Marily
- This topic was modified 8 years, 7 months ago by Marily12.
April 25, 2016 at 8:25 am #621064Hi Marily,
Sorry for the late reply, could you please provide us with a temporary admin login so that we can take a closer look? You can post the details in the Private Content section of your reply.
Thanks,
RikardApril 25, 2016 at 6:09 pm #621562Hi,
please find the details below!
Best regardsApril 28, 2016 at 7:05 am #623488Hi!
Try to add the opt out link in a code block:
<a href="javascript:gaOptout()">Click here to opt-out of Google Analytics</a>
This link might be able to help: http://webgilde.com/en/analytics-opt-out/
Regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.