Title: Duplicate / Nesting Code
Last modified: April 26, 2019

---

# Duplicate / Nesting Code

 *  Resolved [Lens Digital](https://wordpress.org/support/users/lensdigital/)
 * (@lensdigital)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/duplicate-nesting-code/)
 * Hi,
 * I have a client who has nested / duplicate GA code from this plugin;
 *     ```
       <script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-1"></script>
       <script>
       window.dataLayer = window.dataLayer || [];
       function gtag(){dataLayer.push(arguments);}
       gtag('js', new Date());
       gtag('config', 'UA-xxxxxxxxx-1', <!-- Global site tag (gtag.js) - Google Analytics -->
       <script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-1"></script>
       <script>
       window.dataLayer = window.dataLayer || [];
       function gtag(){dataLayer.push(arguments);}
       gtag('js', new Date());
       gtag('config', 'UA-xxxxxxxxx-1');
       </script>);
       </script>
       ```
   
 * They have gtag.js enabled and are using Custom Tracker Objects. Is it necessary
   to use both or is this the cause of the duplication?
 * Thanks
    -  This topic was modified 7 years, 1 month ago by [Lens Digital](https://wordpress.org/support/users/lensdigital/).

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

 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/duplicate-nesting-code/#post-11470633)
 * This plugin does not add any duplicate code. What you are seeing must be from
   another plugin or maybe something the theme is doing. You can do some basic [troubleshooting](https://perishablepress.com/how-to-troubleshoot-wordpress/)
   to determine the source of the issue. Let me know if I can provide any further
   infos, glad to help.
 *  Thread Starter [Lens Digital](https://wordpress.org/support/users/lensdigital/)
 * (@lensdigital)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/duplicate-nesting-code/#post-11470663)
 * It was a user error in the setup of the plugin. They had pasted the gtag code
   into the Custom Tracker Object.
 * So the plugin was inserting the code correctly but it was being duplicated by
   the code the user had also inserted.
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/duplicate-nesting-code/#post-11470675)
 * Ah that explains it, glad you got it sorted.

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

The topic ‘Duplicate / Nesting Code’ is closed to new replies.

 * ![](https://ps.w.org/ga-google-analytics/assets/icon-256x256.png?rev=2053004)
 * [GA Google Analytics – Connect Google Analytics to WordPress](https://wordpress.org/plugins/ga-google-analytics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ga-google-analytics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ga-google-analytics/)
 * [Active Topics](https://wordpress.org/support/plugin/ga-google-analytics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ga-google-analytics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ga-google-analytics/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/duplicate-nesting-code/#post-11470675)
 * Status: resolved