Multiple installations of gtag.js, can't find 2nd tag

Sandra80
Shopify Partner
16 0 3

Hi,

 

Google tag assistant tells me:

"Multiple installations of Global site tag (gtag.js) detected",

Basically I have 2 identical Google ads (gtag.js) AW- tags installed on my site.

But looking in the source code I can only find one.

How can I locate and remove the second one?

 

Thanks!

 

Replies 13 (13)

NSEImports
Excursionist
33 0 10

You may have two entries on your store, do you have your Google Analytics code in Online Store-->Preferences-->Google Analytics? That's the easiest place to install it, but in the older times you had to pop the gtag script into your theme's header code.

 

To find that you might need to dig around your Theme's source code to see if there is an entry, try looking under Themes--> Live Theme-->Actions-->Edit Code then search for 'header', you should see a 'header--default.liquid' (can vary depending on theme) and you may find your rogue Google Tag in there. Per Add gtag script @ Google you are looking for something along the lines of:

 

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){window.dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'GA_MEASUREMENT_ID');
</script>

 

Remember to duplicate your theme if your not comfy editing code things. Hope that helps. 🙂

Doing many things all day everyday
Sandra80
Shopify Partner
16 0 3

Tank you for the reply.

We have installed the tag in the theme.liquid file. But I can only find 1 there, not 2.

I have searched for my Google ID, "gtag", etc. but I can not find any other implementation than the one I did.

 

NSEImports
Excursionist
33 0 10

Have you checked in the Online Store-->Preferences as well? (see pic) If you have an analytics code there, Shopify will load a second gtag through their dynamic loader so you won't find it in the source.

 

You may have a tag hereYou may have a tag here

 

If you have an entry here you should not need the one in your theme.liquid as the Shopify implementation does everything for you. 

Doing many things all day everyday
SB_90
Shopify Partner
216 52 68

Hi @Sandra80 

 

Can you share site URL and password (by DM if you prefer) and we can try and track down where they're being fired from?

p1Commerce
Shopify Partner
125 17 63

Are the Analytics account ID's the same?

Do you use Criteo?  I've seen this before where Criteo was injecting their own Analytics onto the page.

Appreciate the assistance? Please hit the Like and Accepted Solution buttons.
--
An Exceptionally Technical eCommerce Firm
Entirely Focused on Search Position - p1commerce.com
Sandra80
Shopify Partner
16 0 3

No, not using Criteo, the tag is Google ads, not Analytics.

Analytics works fine, but Google ads tag is double (AW-XXXXX)

p1Commerce
Shopify Partner
125 17 63

If you PM me the domain I'll be happy to have a look.

Appreciate the assistance? Please hit the Like and Accepted Solution buttons.
--
An Exceptionally Technical eCommerce Firm
Entirely Focused on Search Position - p1commerce.com

Sandra80
Shopify Partner
16 0 3

Screen Shot 2022-05-30 at 21.55.10.png

The tag is not Analytics, but Google ads.

Analytics tag is fine, but Google ads tag is showing 2 times.

See screenshot please 🙂

NSEImports
Excursionist
33 0 10

Ah, double ad tags, that's weird. Do you by chance use Google Tag Manager? If you have the ads tag in there, plus an older ads tag that would give you two entries?

 

Tag Manager has the following script that might likely in your theme.liquid from your previous reply.

 

<!-- Google Tag Manager -->
<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-xxxxxx');</script>
<!-- End Google Tag Manager -->

 

 

This would load your ad tracking twice, you would never see the second gtag.js as it is loaded externally to your site by google.

Doing many things all day everyday
Sandra80
Shopify Partner
16 0 3

Thank you, we have the GTM installed but the container is empty.

NSEImports
Excursionist
33 0 10

That is a weird one. I'm can't think of anything else to suggest on this aside from maybe removing the empty tag manager temporarily see if that helps.

Doing many things all day everyday
Sandra80
Shopify Partner
16 0 3

I did that but it didnt help. Also tag assistant doesnt detect the GTM either way.

DDDigitalMS
Shopify Partner
23 0 11

Did you ever find a solution to this? I'm experiencing the same issue, with multiple GTM tags on the website, but I cannot find them anywhere in the code. We are using the Google & YouTube app which is connected to all accounts, and in the theme.liquid file, I can see the correct G- code to match our Google Analytics. But cannot for the life of me find the GTM tags hidden anywhere, despite them flagging as errors on the Google Tag Assistant Legacy tool

DD Digital Marketing Services - UK
Shopify Website Build and Management | SEO | Marketing