Title: Google Analytics Script Code Changed by Plugin
Last modified: May 19, 2018

---

# Google Analytics Script Code Changed by Plugin

 *  [TimothyDalton](https://wordpress.org/support/users/timothydalton/)
 * (@timothydalton)
 * [8 years ago](https://wordpress.org/support/topic/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 8 years ago by [TimothyDalton](https://wordpress.org/support/users/timothydalton/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [antiquecollecting](https://wordpress.org/support/users/antiquecollecting/)
 * (@antiquecollecting)
 * [8 years ago](https://wordpress.org/support/topic/google-analytics-script-code-changed-by-plugin/#post-10317034)
 * 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.
 *  [Alicia](https://wordpress.org/support/users/sexydawnt/)
 * (@sexydawnt)
 * [8 years ago](https://wordpress.org/support/topic/google-analytics-script-code-changed-by-plugin/#post-10320439)
 * 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.
 *  [Alicia](https://wordpress.org/support/users/sexydawnt/)
 * (@sexydawnt)
 * [8 years ago](https://wordpress.org/support/topic/google-analytics-script-code-changed-by-plugin/#post-10320448)
 * 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 8 years ago by [Alicia](https://wordpress.org/support/users/sexydawnt/).
 *  [cweyant](https://wordpress.org/support/users/cweyant/)
 * (@cweyant)
 * [8 years ago](https://wordpress.org/support/topic/google-analytics-script-code-changed-by-plugin/#post-10329453)
 * 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.

 * ![](https://ps.w.org/cookie-notice/assets/icon-256x256.png?rev=3549327)
 * [Compliance by Hu-manity.co](https://wordpress.org/plugins/cookie-notice/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cookie-notice/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cookie-notice/)
 * [Active Topics](https://wordpress.org/support/plugin/cookie-notice/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cookie-notice/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cookie-notice/reviews/)

## Tags

 * [blocking](https://wordpress.org/support/topic-tag/blocking/)
 * [script](https://wordpress.org/support/topic-tag/script/)

 * 4 replies
 * 4 participants
 * Last reply from: [cweyant](https://wordpress.org/support/users/cweyant/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/google-analytics-script-code-changed-by-plugin/#post-10329453)
 * Status: not resolved