Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #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&#8217;,’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-Option

    Point 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 Analytics

    If 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.
    #621064

    Hi 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,
    Rikard

    #621562

    Hi,
    please find the details below!
    Best regards

    #623488

    Hi!

    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

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.