Remove duplicate tags after migrating to the Google & YouTube app on Shopify

After migrating your Shopify store's Google Ads and Google Analytics measurement to the Google & YouTube app, it's crucial to remove any previously installed duplicate tags. If you're currently bidding to custom pixel-tracked Shopify conversions, make sure to switch your conversion action to the one measured by the Google & YouTube app. Learn more about Migrating your tags to the Google & YouTube app

If you don’t remove your duplicate tagging you may find:

  • Duplicate tracking
  • Inaccurate data
  • Negative impact to your ad campaign optimization

How to fix your issue

Read the following sections below for instructions on how to remove duplicate tags spending on where you implemented them:


Remove duplicate custom pixel tags

  1. From your Shopify admin, go to Settings, then Customer events in your Shopify admin.
  2. Find the custom pixel you want to disable.
  3. Click Disconnect next to the pixel.
  4. To remove the pixel entirely, click Delete, and then confirm the deletion.

Remove duplicate direct tags from additional scripts

Note: The Order status page additional scripts section in your Shopify admin isn't expandable. If you have a lot of code in this section, then consider copying and pasting the code into an external text editor tool to find the specific script that you want to deactivate.

If you've already upgraded your Thank You page, additional scripts are no longer accessible or supported in the new checkout flow. These scripts should have stopped working automatically, so no manual removal is needed.

  1. From your Shopify admin, go to Settings, then Checkout.
  2. In the Order status page additional scripts section, find the additional script that you want to remove, and then type <!-- at the beginning of the script, and --> at the end of the script.
  3. Click Save.
  4. Check your Google tags again to make sure that events are still being received.

If events aren't loading on your store or received by the Google products after installing and testing the Google & YouTube app.


Remove duplicate direct tags from checkout.liquid

If you've already upgraded your Thank You page, check.liquid scripts are no longer accessible or supported in the new checkout flow. These scripts should have stopped working automatically, so no manual removal is needed.

Step 1: Back up your theme

  1. From your Shopify admin, go to Online Store, then Themes.
  2. Find the theme you’re currently using with the label “Current theme” and click, three dots then, Duplicate. This creates a complete copy of your theme, so you can revert to it if anything goes wrong.

Step 2: Access checkout.liquid

  1. From your Shopify admin, go to Online Store, then Themes.
  2. Find the theme you’re currently using the label “Current theme” (or the duplicated copy you just made, if you prefer to work on that) and click the three dot icon, then Edit code.
  3. In the left-hand sidebar, scroll down to the "Layout" section and click on checkout.liquid.

Step 3: Identify and remove duplicate tags

Carefully identify the tags that were previously used for tracking and are now being handled by the Google & YouTube app. These typically include Google Analytics, Google Ads conversion measurement, Merchant Center, Floodlight, and potentially Google Tag Manager. Follow the steps below to identify and remove the duplicate tags:

Common code snippets to look for (and remove):

  • Legacy Google Analytics (Universal Analytics or GA4) tags

Look for script tags containing google-analytics.com/analytics.js.

  • Universal Analytics (UA-XXXXX-Y):

<script>

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)

})(window,document,'script','https://google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXX-Y', 'auto');

ga('send', 'pageview');

</script>

  • gtag.js for Google Analytics (GA4) , Google Ads Conversion Tracking, Merchant Center, or Floodlight: Look for <script> tags that contain googletagmanager.com/gtag/js?

<script async src="https://googletagmanager.com/gtag/js?id=X-XXXXXXXXXX"></script>

<script>

  window.dataLayer = window.dataLayer || [];

  function gtag(){dataLayer.push(arguments);}

  gtag('js', new Date());

  gtag('config', 'X-XXXXXXXXXX');

</script>

  • Event snippets
    • Look for <script> tags that contain gtag (‘event’...)

<script>

  gtag('event', 'XXXX', {

      'send_to': 'XX-XXXXXXXXX/YYYYYYYYYY',

      'value': {{ checkout.total_price | money_without_currency | remove: "," }},

      'currency': '{{ shop.currency }}',

      'transaction_id': '{{ order.order_number }}'

  });

</script>

  • Google tag manager (GTM) snippets
  • If you're using GTM, you'll typically have two parts: a <script> tag in the <head> and a <noscript> tag immediately after the <body> tag.

<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://googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);

})(window,document,'script','dataLayer','i-gno/re-dXXXXXXX');</script>
  • And the <noscript> part:

<noscript><iframe src="https://googletagmanager.com/ns.html?id=i-gno/re-dXXXXXXX"

height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

Steps to Remove:

  1. Carefully examine your checkout.liquid file. Scroll through it and look for the code snippets similar to the examples above.
  2. Highlight the entire block of code associated with the duplicate tag. This includes the opening and closing script tags, and any comments related to it.
  3. Delete the highlighted code.

Important Considerations:

  • Don't delete essential Shopify Liquid code: Be extremely careful not to delete any Liquid objects or tags that are part of Shopify's core functionality (for example: {{ content_for_header }}, {{ content_for_layout }}, {{ page_title }}, and others).
  • Look for conditional statements: Sometimes, tracking codes are wrapped in {% if first_time_accessed %} or {% if thank_you_page %}. Make sure to remove the code within these conditions as well.
  • Search function: Use the search function within the code editor (Cmd/Ctrl + F) to search for common identifiers like gtag, UA-, AW-, i-gno/re-d, google-analytics.com, googletagmanager.com, googleadservices.com.

Step 4: Save your changes

  1. After deleting the duplicate code, click the Save button in the top right corner of the editor.

Step 5: Test your checkout

  1. Crucially, perform a test purchase on your store. Go through the entire checkout process to ensure everything is working correctly.
  2. Verify tracking: Use tools like Google Tag Assistant to verify that your tags are firing correctly only from the Google & YouTube app and not from the checkout.liquid file.

If you’re unsure about any specific code, it’s always recommended to consult with a Shopify expert or developer.


Remove duplicate tags from theme.liquid

Step 1: Back up your theme

  1. From your Shopify admin, go to Online Store, then Themes.
  2. Find the theme you’re currently using and click the three dot icon, then Duplicate. This creates a complete copy of your theme, so you can revert to it if anything goes wrong.

Step 2: Access theme.liquid

  1. From your Shopify admin, go to Online Store, then Themes.
  2. Find the theme you’re currently using (or the duplicated copy you just made) and click the three dot icon, then Edit code.
  3. In the left-hand sidebar, under the "Layout" section, click on theme.liquid.

Step 3: Identify and remove duplicate tags

Just like with checkout.liquid, you'll be looking for code snippets related to Google Analytics, Google Ads, and Google Tag Manager that you previously manually added and are now being handled by the Google & YouTube app. These are typically placed within the <head> section of your theme.liquid file. Follow the steps below to identify and remove the duplicate tags:

Common code snippets to look for (and remove):

  • Legacy Google Analytics (Universal Analytics or GA4) tags

Look for script tags containing google-analytics.com/analytics.js.

  • Universal Analytics (UA-XXXXX-Y):

<script>

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)

})(window,document,'script','https://google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXX-Y', 'auto');

ga('send', 'pageview');

</script>

  • gtag.js for Google Analytics (GA4) , Google Ads Conversion Tracking, Merchant Center, or Floodlight: Look for <script> tags that contain googletagmanager.com/gtag/js?

<script async src="https://googletagmanager.com/gtag/js?id=X-XXXXXXXXXX"></script>

<script>

  window.dataLayer = window.dataLayer || [];

  function gtag(){dataLayer.push(arguments);}

  gtag('js', new Date());

  gtag('config', 'X-XXXXXXXXXX');

</script>

  • Event snippets
    • Look for <script> tags that contain gtag (‘event’...)

<script>

  gtag('event', 'XXXX', {

      'send_to': 'XX-XXXXXXXXX/YYYYYYYYYY',

      'value': {{ checkout.total_price | money_without_currency | remove: "," }},

      'currency': '{{ shop.currency }}',

      'transaction_id': '{{ order.order_number }}'

  });

</script>

  • Google tag manager (GTM) snippets
  • If you're using GTM, you'll typically have two parts: a <script> tag in the <head> and a <noscript> tag immediately after the <body> tag.

<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://googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);

})(window,document,'script','dataLayer','i-gno/re-dXXXXXXX');</script>
  • And the <noscript> part:

<noscript><iframe src="https://googletagmanager.com/ns.html?id=i-gno/re-dXXXXXXX"

height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

Steps to Remove:

  1. Carefully examine your theme.liquid file. Scroll through it and look for the code snippets similar to the examples above. These are most commonly found within the <head> section, but sometimes script tags can be at the bottom of the <body> before the closing </body> tag.
  2. Highlight the entire block of code associated with the duplicate tag. This includes the opening and closing script tags, and any comments related to it.
  3. Delete the highlighted code.

Important Considerations:

  • Don't delete essential Shopify Liquid code: Be extremely careful not to delete any Liquid objects or tags that are part of Shopify's core functionality (for example: {{ content_for_header }}, {{ content_for_layout }}, {{ page_title }}, and others).
  • Look for conditional statements: Sometimes, tracking codes are wrapped in {% if template == 'index' %} or other conditional logic. Make sure to remove the code within these conditions as well if it's a duplicate.
  • Search function: Use the search function within the code editor (Cmd/Ctrl + F) to search for common identifiers like gtag, UA-, AW-, i-gno/re-d, google-analytics.com, googletagmanager.com, googleadservices.com.

Step 4: Save your changes

  1. After deleting the duplicate code, click the Save button in the top right corner of the editor.

Step 5: Test your store

  1. Visit various pages on your store (homepage, product pages, collection pages).
  2. Use Google Tag Assistant (a Chrome extension) to verify that your tags are firing correctly only from the Google & YouTube app and not from the theme.liquid file. You should view the tags associated with the Google & YouTube app firing, and no longer view the old, duplicate tags.

If you’re unsure about removing any specific code, it’s always recommended to consult with a Shopify expert or a web developer.


Next steps

After making the requested changes, check that you’ve fixed the issue by making sure it’s no longer listed on the “Needs attention” page.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Main menu
672092099491634391
true
Search Help Center
false
true
true
true
true
true
71525
false
false
false
false