• Resolved Lens Digital

    (@lensdigital)


    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 5 years, 11 months ago by Lens Digital.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jeff Starr

    (@specialk)

    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 to determine the source of the issue. Let me know if I can provide any further infos, glad to help.

    Thread Starter Lens Digital

    (@lensdigital)

    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

    (@specialk)

    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.