Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #801477

    Hello,

    in order to anonymize Google Analytics I put the following in front of the Google Analytics tracking code

    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>

    Bits of this are now showing in the socket on the left hand side. Is there a chance to fix this?

    Thanks for your assistance!

    #802168

    Hey hasbeat,

    Please change your code to following one

    
    <script>ga('create', 'UA-XXXXXXXX-X', 'auto');
    ga('set', 'anonymizeIp', true);
    ga('send', 'pageview');
    </script>
    <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>

    Best regards,
    Yigit

    #802198

    Hi Yigit,

    Thanks for your quick reply. The code is gone, however, the tracking code is still there.

    #802199

    Hi,

    Code was wrong. I corrected it. Please see private content field below for more information

    Best regards,
    Yigit

    #802207

    Yigit – Great job, thank you so much!

    #802209

    Hey!

    You are welcome Hasbeat :)

    Cheers!
    Yigit

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Google Analytics – data privacy’ is closed to new replies.