Title: Mangled gtag code in Script Blocking Head field
Last modified: May 27, 2018

---

# Mangled gtag code in Script Blocking Head field

 *  [cweyant](https://wordpress.org/support/users/cweyant/)
 * (@cweyant)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/mangled-gtag-code-in-script-blocking-head-field/)
 * I’m trying adding Google Analytics (gtag) code in Head field for script blocking,
   but the URL keeps getting having `<a>` tags put around it.
 * When I save it, this:
 *     ```
       <!-- Global site tag (gtag.js) - Google Analytics -->
       <script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-1"></script>
       <script>
         window.dataLayer = window.dataLayer || [];
         function gtag(){dataLayer.push(arguments);}
         gtag('js', new Date());
   
         gtag('config', 'UA-XXXXXXXX-1');
       </script>
       ```
   
 * Becomes this:
 *     ```
       <!-- Global site tag (gtag.js) - Google Analytics -->
       <a href="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-1">https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-1</a>
       <script>
         window.dataLayer = window.dataLayer || [];
         function gtag(){dataLayer.push(arguments);}
         gtag('js', new Date());
   
         gtag('config', 'UA-XXXXXXXX-1');
       </script>
       ```
   
 * I’m admin on the site, so it shouldn’t be a permissions thing. What’s going on
   here?
    -  This topic was modified 7 years, 10 months ago by [cweyant](https://wordpress.org/support/users/cweyant/).

Viewing 1 replies (of 1 total)

 *  [golfingherald](https://wordpress.org/support/users/golfingherald/)
 * (@golfingherald)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/mangled-gtag-code-in-script-blocking-head-field/#post-10869230)
 * Hi…..I have got the identical situation, so does anybody know how to resolve?
   This manifests by seeing [https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-1](https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-1)
   at the top of my website
 * Any help would be much appreciated
 * Regards
 * Paul

Viewing 1 replies (of 1 total)

The topic ‘Mangled gtag code in Script Blocking Head field’ is closed to new replies.

 * ![](https://ps.w.org/cookie-notice/assets/icon-256x256.png?rev=2466385)
 * [Cookie Notice & Compliance for GDPR / CCPA](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/)

 * 1 reply
 * 2 participants
 * Last reply from: [golfingherald](https://wordpress.org/support/users/golfingherald/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/mangled-gtag-code-in-script-blocking-head-field/#post-10869230)
 * Status: not resolved