Is there a setting on Google Analytics to suppress use of cookies for users who have not yet given consent

后端 未结 13 1259
深忆病人
深忆病人 2020-12-02 03:33

According to EU Article 5(3) of the E-Privacy Directive (a.k.a \'The Cookie Laws\'), web sites that target EU users have to gain opt-in consent from users before they set a

相关标签:
13条回答
  • 2020-12-02 04:17

    I often never ask users to opt out for google analytics, that is because i never set cookies and i never save their ip (and other personal data).

    (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','//www.google-analytics.com/analytics.js','ga');
    
    ga('create', 'UA-98765432-1', 'www.example.com', {
      'anonymizeIp': true
      , 'storage': 'none'
      , 'clientId': window.localStorage.getItem('ga_clientId')
    });
    ga(function(tracker) {
      window.localStorage.setItem('ga_clientId', tracker.get('clientId'));
    });
    ga('send', 'pageview');
    

    Also check out this code at Convert Google Analytics cookies to Local/Session Storage

    This script will not set any cookies, but still track via google analytics. This will actually have the same effect on privacy as using cookies, because google still records the users IP-address.

    That is where the anonymizeIp switch comes in. This tells google to only save an anonymized version of the IP-address. An anonymized IP-address is not considered personal data, so the users privacy will be respected.

    AFAIK cookie law is all about privacy and does allow website to track their usage. I am not a lawyer or anything but in my opinion this script complies to the EU cookie law.

    Check out this plunk to see it in action: http://plnkr.co/MwH6xwGK00u3CFOTzepK

    0 讨论(0)
提交回复
热议问题