Support » Plugin: Cookie Notice for GDPR & CCPA » Google Analytics Script Code Changed by Plugin

  • Greetings developers,

    first of all thank you for this great plugin.

    When inserting our google analytics code block to the script blocking section..

    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-116736819-1"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'UA-116736819-1');
    </script>

    The plugin automatically changes it to:

    <!-- Global site tag (gtag.js) - Google Analytics -->
    <a href="https://www.googletagmanager.com/gtag/js?id=UA-116736819-1">https://www.googletagmanager.com/gtag/js?id=UA-116736819-1</a>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

    And thereby replaces the first script tag with an a href. I guess this is the reason why no events are fired to Google Analytics, can this be the case?

    What am I missing here? Thank you for your help.

    //Tim

    • This topic was modified 2 years, 5 months ago by TimothyDalton.
Viewing 4 replies - 1 through 4 (of 4 total)
  • I have the same problem – this change means that a link is created at the bottom of the page as opposed to loading in the source code.

    Same problem here. Also, someone else on their support forum asked that same question on May 7, but the dev hasn’t helped her yet.

    However, when I just use this:
    <script async src=”https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-1″></script>, it seems to work. Still testing to see if it is actually blocking cookies at that point

    UPDATE: Nope – it still tracks the cookies – plus it’s still tracking the cookies from Amazon, even though it didn’t throw an error.

    • This reply was modified 2 years, 5 months ago by Alicia.

    I am having this same problem as well. Still no answer?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Google Analytics Script Code Changed by Plugin’ is closed to new replies.