Analytics __ga TAG doesn’t get injected after click on “Accept”
-
Hi everyone, I’ve being banging my head against walls since GDPR came out.
I haven’t been able to find a plugin good looking and easy to make my website GDPR compliant.
Cookie notice seems to be easy and good looking, (or may be I’m writing <head> code wrong).
The problem is that in Italy analytical cookies (suck as GA) should be activated only after user acceptance. Well, Cookie notice has a section saying exactly that.
That’s the code I wrote inside HEAD section (obviously changing UA id to mine):
<!-- Google Analytics --> <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-XXXXX-Y', 'auto'); ga('send', 'pageview'); </script> <!-- End Google Analytics -->
Now, when I load my page (purged from cache and cookie, I get only cookie “lwpcngStatus” set to 1 (accepted) but no __ga cookies.
Where am I doing wrong?
Thanks in advance,
Francesco
- The topic ‘Analytics __ga TAG doesn’t get injected after click on “Accept”’ is closed to new replies.