• Resolved clem10nt

    (@clem10nt)


    Hi,

    I transitioned to Google Tag Manager and want to use Site Kit to insert the code but it seems there is still some analytics.js and gtag methods in the code of my website coming from the site kit plugin.

    When I check the source code I only see the google tag manager component.

    However, when I inspect my website in chrome I still have analytics.js (https://www.googletagmanager.com/gtag/js) and a gtag script (https://www.googletagmanager.com/gtag/js?id=G-XXXX&l=dataLayer&cx=c”).
    Yet, I already have a script with /gtm.js?id=GTM-XXXXXX

    The Site Kit plugin inserts the Tag Manager Code Snippet.

    The Universal Analytics Code Snippet is well identified as controlled by the Tag Manager module and ‘Place Universal Analytics code’ is off. Google Analytics 4 Code Snippet is not inserted either.

    When I deactivate site Kit, all disappear, analytics.js, gtag and gtm in the inspect window.
    Which tells me I don’t have gtag hard coded in the website anywhere.

    The datalayer parameter in gtag seems to come from GTM but I’m not sure why.

    In GTM:
    I have a web container with a UA variable, a tag for UA and a tag for GA4.
    (I also have an AMP container with an UA AMP tag and an AMP linker tag)

    In Analytics,
    GA4 is associated with UA
    UA is associated with GA4

    In https://tagassistant.google.com/
    I see the GTM container with the UA and GA4 tags firing. But I also see the GA4 tag separately, which seems consistent with the issue I see when I inspect the page.

    Could you please let me know if it’s normal that analytics.js and gtag are included in the code? Is it an issue from Site Kit or is my configuration wrong?

    Thanks a lot.
    Best,

    • This topic was modified 3 years, 10 months ago by clem10nt.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support James Osborne

    (@jamesosborne)

    Hi @clem10nt,

    Thanks for reaching out. If you choose to use Site Kit to insert your Google Analytics snippet, the plugin will make a request similar to the below:
    <script type='text/javascript' src='https://www.googletagmanager.com/gtag/js?id=UA-1838*****' id='google_gtagjs-js' async></script>

    This isn’t a Google Tag Manager specific snippet, despite the reference in the URL. You’ll see this evident also when checking the Google Analytics developer guide for a gtag.js snippet.

    When I deactivate site Kit, all disappear, analytics.js, gtag and gtm in the inspect window.
    Which tells me I don’t have gtag hard coded in the website anywhere.

    Site Kit makes one request to the Google Analytics service if you’ve allow the plugin to insert your Google Analytics snippet. If you’ve added Google Tag Manger via Site Kit there will be an additional request made, similar to the below:

    <!-- Google Tag Manager snippet added by Site Kit -->
    <noscript>
    <iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MF*****" height="0" width="0" style="display:none;visibility:hidden"></iframe>
    </noscript>
    <!-- End Google Tag Manager snippet added by Site Kit -->

    The analytics.js request is only present for logged in administrators, used for the Site Kit admin toolbar. This isn’t requested for normal visitors to your site.

    In https://tagassistant.google.com/
    I see the GTM container with the UA and GA4 tags firing. But I also see the GA4 tag separately, which seems consistent with the issue I see when I inspect the page.

    I’ve checked your site at present and I can see only a GA4 tag firing at present. I’ve checked manually and also using the tagassistant.google.com service. I don’t see a UA snippet placed via Site Kit. If you’d like to enable once more let me know and I’m happy to perform another check.

    Could you please let me know if it’s normal that analytics.js and gtag are included in the code? Is it an issue from Site Kit or is my configuration wrong?

    This is normal if you check your sites source code while logged in, with the analytics.js script only evident for logged in administrators.

    Let me know if you have any further questions on the above and I’d be happy to assist!

    Thread Starter clem10nt

    (@clem10nt)

    Hi @jamesosborne,

    Thank you for helping me out! Sorry, I’m not sure I understand, I’m a bit confused.

    Site Kit makes one request to the Google Analytics service if you’ve allow the plugin to insert your Google Analytics snippet. If you’ve added Google Tag Manger via Site Kit there will be an additional request made

    I don’t want google analytics code, I only want Google Tag Manager code.
    I didn’t allow the plugin to insert Google Analytics snippet (An existing Google Tag Manager property was found on your site with the ID UA-XXXXXX-X. Since it refers to the same property selected here, Site Kit will not place its own tag and rely on the existing one.)
    I have even disconnected Google Analytics from Site Kit now.

    I’ve checked your site at present and I can see only a GA4 tag firing at present. I’ve checked manually and also using the tagassistant.google.com service. I don’t see a UA snippet placed via Site Kit.

    Ok, weird. When I check, I have a Google Tag Manager container, where inside it I have tags for Universal Analytics and Google Analytics Configuration GA4.
    But there is another container “Output of G-XXXXX” that refers to GA4. I think I need to get rid of this one since I already have a GA4 tag in the GTM container.
    I’ve performed the check not logged in to wordpress or google.

    The analytics.js request is only present for logged in administrators, used for the Site Kit admin toolbar. This isn’t requested for normal visitors to your site.

    Ok but I get the analytics.js in incognito window or in guest mode where I’m not logged in, neither in wordpress nor in google.

    • This reply was modified 3 years, 10 months ago by clem10nt.
    Plugin Support James Osborne

    (@jamesosborne)

    Hi @clem10nt,

    No problem at all! See answers below to your queries:

    I don’t want google analytics code, I only want Google Tag Manager code.
    I didn’t allow the plugin to insert Google Analytics snippet (An existing Google Tag Manager property was found on your site with the ID UA-XXXXXX-X. Since it refers to the same property selected here, Site Kit will not place its own tag and rely on the existing one.)
    I have even disconnected Google Analytics from Site Kit now.

    In that case there won’t be any gtag resource evident from checking your sites source code. Analytics will fire, but from within any tag you’ve added within the connected Google Tag Manager container. The snippets that will appear, as placed via Site Kit will look similar to the below:

     <!-- Google Tag Manager snippet added by Site Kit -->
    <script>
    			( function( w, d, s, l, i ) {
    				w[l] = w[l] || [];
    				w[l].push( {'gtm.start': new Date().getTime(), event: 'gtm.js'} );
    				var f = d.getElementsByTagName( s )[0],
    					j = d.createElement( s ), dl = l != 'dataLayer' ? '&l=' + l : '';
    				j.async = true;
    				j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
    				f.parentNode.insertBefore( j, f );
    			} )( window, document, 'script', 'dataLayer', 'GTM-5C3XTST' );
    			
    </script>
    
    <!-- End Google Tag Manager snippet added by Site Kit -->
    <!-- Google Tag Manager (noscript) snippet added by Site Kit -->
    		<noscript>
    			<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5C3XTST" height="0" width="0" style="display:none;visibility:hidden"></iframe>
    		</noscript>
    <!-- End Google Tag Manager (noscript) snippet added by Site Kit -->

    Ok, weird. When I check, I have a Google Tag Manager container, where inside it I have tags for Universal Analytics and Google Analytics Configuration GA4.
    But there is another container “Output of G-XXXXX” that refers to GA4. I think I need to get rid of this one since I already have a GA4 tag in the GTM container.
    I’ve performed the check not logged in to wordpress or google.

    I’ve checked your site once more using tagassistant.google.com and indeed I only see one GA4 tag firing. If you have added a Universal Type analytics tag, you can check whther this is published. If you’re finding anything unusual with reporting on this tag you can reach out to the product experts at the Tag Manager Help Center. Alternatively you can choose to allow Site Kit to insert the snippet if you wish.

    Ok but I get the analytics.js in incognito window or in guest mode where I’m not logged in, neither in wordpress nor in google.

    That’s very strange. I don’t see it when checking your site source code once more – recording. If you’re doing some deeper troubleshooting, such as with Chromes developer tools, you may find any Analytics references based on you inserting an Analytics tag inside your connected Google Tag Manager account.

    Let me know if you have any questions with the above! If none I’ll close this topic. Have a great weekend!

    Thread Starter clem10nt

    (@clem10nt)

    That’s very strange. I don’t see it when checking your site source code once more – recording.

    Thanks for the recording. It’s not in the source code, correct, but when we inspect, i.e. Ctrl + Shift + C, it shows up in the elements tab.

    That’s the inspect tool I have been looking at when I mention the gtag, analytics.js etc.

    Plugin Support James Osborne

    (@jamesosborne)

    In that case the Analytics script requested is coming from Tag Manager, and not Site Kit. This is why you don’t see it within the sites source code.

    If you switch to allowing Site Kit to insert your snippets, you’ll see a snippet similar to the below, referencing your own property:

    <script type='text/javascript' src='https://www.googletagmanager.com/gtag/js?id=UA-1838*****' id='google_gtagjs-js' async></script>

    Let me know if you have any further questions on this.

    Plugin Support James Osborne

    (@jamesosborne)

    As we didn’t receive a response I’ll mark this as resolved. Feel free to open a new support topic if you continue to encounter issues, or reopen this topic and we’d be happy to assist.

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

The topic ‘Using Google Tag Manager and having analytics.js’ is closed to new replies.