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
- Remove duplicate tags from checkout additional scripts
- Remove duplicate tags from
checkout.liquid - Remove duplicate tags from
theme.liquid
Remove duplicate custom pixel tags
Google Analytics [Video] Remove duplicate custom pixel 2nd entry
- From your Shopify admin, go to Settings, then Customer events in your Shopify admin.
- Find the custom pixel you want to disable.
- Click Disconnect next to the pixel.
- 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.
- From your Shopify admin, go to Settings, then Checkout.
- In the "Additional scripts" section, find the script that you want to remove.
- Click Disable script.
- Check your Google tags to make sure that events are still being received.
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.
Google Analytics [Video] Remove duplicate direct tags from checkout liquid All steps
Step 1: Back up your theme
Google Analytics [Video] Remove duplicate direct tags from checkout liquid Step 1
- From your Shopify admin, go to Online Store, then Themes.
- 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
Google Analytics [Video] Remove duplicate direct tags from checkout liquid Step 2
- From your Shopify admin, go to Online Store, then Themes.
- 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.
- In the left-hand sidebar, scroll down to the "Layout" section and click on
checkout.liquid.
Step 3: Identify and remove duplicate tags
Google Analytics [Video] Remove duplicate direct tags from checkout liquid Steps 3 4
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.jsfor 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’...)
- Look for
<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:
- Carefully examine your
checkout.liquidfile. Scroll through it and look for the code snippets similar to the examples above. - 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.
- 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
- After deleting the duplicate code, click the Save button in the top right corner of the editor.
Step 5: Test your checkout
- Crucially, perform a test purchase on your store. Go through the entire checkout process to ensure everything is working correctly.
- 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.liquidfile.
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
Google Analytics [Video] Remove duplicate tags from theme liquid All steps
Step 1: Back up your theme
- From your Shopify admin, go to Online Store, then Themes.
- 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
Google Analytics [Video] Remove duplicate tags from theme liquid Step 2
- From your Shopify admin, go to Online Store, then Themes.
- Find the theme you’re currently using (or the duplicated copy you just made) and click the three dot icon, then Edit code.
- In the left-hand sidebar, under the "Layout" section, click on
theme.liquid.
Step 3: Identify and remove duplicate tags
Google Analytics [Video] Remove duplicate tags from theme liquid Steps 3 4
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.jsfor 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’...)
- Look for
<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:
- Carefully examine your
theme.liquidfile. 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. - 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.
- 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
- After deleting the duplicate code, click the Save button in the top right corner of the editor.
Step 5: Test your store
- Visit various pages on your store (homepage, product pages, collection pages).
- 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.liquidfile. 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.