Created on 19 January, 2016 | Updated on 13 July, 2021
Adding Google Adwords Remarketing Tag To Shopify

How To Add Google Ads Remarketing Tag To Shopify

An easy step by step guide on how to add Google Ads remarketing tag to Shopify using the latest features.

Step 1) Get Your Audience Source Tag ID

Login to Google Ads, then in the top right corner click on the 3dot menu and select Audience Manager from the Shared Library section

From the left hand menu, click on Audience Source

Depending if you have an existing setup or not choose option 1 or 2.

Option 1: Click on setup tag

Option 2: Or click on the 3dot menu and choose edit source within the Adwords tag section

Select the following

  • Dynamic Remarketing
    • Collect specific attributes or parameters to personalize ads
  • Business Type
    • Retail

Click on Install the tag yourself

If you get a choice to choose the old or new one, click on the new one and copy the event code to a plain text editor. And copy the numeric source tag id as shown in the image below for later use. We will add the source tag id to the script below.

Step 2) Adding The Tracking Code To theme.liquid

  • Login to your Shopify Admin Panel
  • Open up the theme editor by going to Online Store > Themes
  • Now choose Actions > Edit Code

Click on theme.liquid inside the layout folder

From the code example below, edit the value between code settings start and end. Do not change anything else or you might break the functionality. I have highlighted below what you can edit.

  1. Copy the below code into a text editor and replace the fa_google_ads_audience_tag_id value to your audience tag id
  2. By default the code is set up for the US, if you targeting a different country, change the value of fa_product_id_alpha2_code to your target country alpha2. For example, the United Kingdom is GB. You can find the full list here: https://help.shopify.com/en/api/custom-storefronts/storefront-api/reference/enum/countrycode
  3. The following step requires you to check the product id in Google Merchant Center > Products > List. And see what ID you are using.
    1. If it looks like shopify_US_81191654332_1055121650148, then keep fa_product_id set to default
    2. If it looks like 1055121650148 then set the value fa_product_id to product_id
    3. If it looks like the main id 81191654332 then set the value fa_product_id to parent_id
    4. If it looks like a sku then set the value fa_product_id to sku

When you have updated the code settings, paste it in the theme.liqued file between the opening and closing head tag. <head></head>

<!-- Google Ads Remarketing Tag By FeedArmy Version 2.16 START -->
<!-- FeedArmy tutorial found at https://feedarmy.com/kb/adding-google-adwords-remarketing-tag-to-shopify/ -->

<!-- CODE SETTINGS START -->
<!-- CODE SETTINGS START -->

<!-- Please add your Google Ads Audience Source Tag ID -->
{% assign fa_google_ads_audience_tag_id = 123456789 %}

<!-- Please add your alpha2 code, you can find it here: https://help.shopify.com/en/api/custom-storefronts/storefront-api/reference/enum/countrycode -->
{% assign fa_product_id_alpha2_code = 'US' %}

<!-- set your product id values are default, product_id, parent_id, sku-->
{% assign fa_product_id = 'default' %}

<!-- CODE SETTINGS END -->
<!-- CODE SETTINGS END -->

<!-- ==================================== -->
<!-- DO NOT EDIT ANYTHING BELOW THIS LINE -->
{% if fa_google_coding %}{% assign fa_google_coding = true %}{%- else -%}{% assign fa_google_coding = false %}{%- endif -%}
{% if fa_google_coding == false %}
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-{{ fa_google_ads_audience_tag_id }}"></script>
{%- endif -%}
{%- assign fa_current_variant = product.selected_or_first_available_variant -%}
{%- if cart.currency.iso_code == 'GBP' or cart.currency.iso_code == 'USD' or cart.currency.iso_code == 'CAD' or cart.currency.iso_code == 'AUD' or cart.currency.iso_code == 'BWP' or cart.currency.iso_code == 'BND' or cart.currency.iso_code == 'DOP' or cart.currency.iso_code == 'GTQ' or cart.currency.iso_code == 'HKD' or cart.currency.iso_code == 'INR' or cart.currency.iso_code == 'ILS' or cart.currency.iso_code == 'YEN' or cart.currency.iso_code == 'KES' or cart.currency.iso_code == 'KOR' or cart.currency.iso_code == 'LBP' or cart.currency.iso_code == 'MYR' or cart.currency.iso_code == 'MXN' or cart.currency.iso_code == 'NPR' or cart.currency.iso_code == 'NZD' or cart.currency.iso_code == 'NIO' or cart.currency.iso_code == 'NGN' or cart.currency.iso_code == 'PKR' or cart.currency.iso_code == 'CNY' or cart.currency.iso_code == 'PHP' or cart.currency.iso_code == 'SGD' or cart.currency.iso_code == 'LKR' or cart.currency.iso_code == 'CHF' or cart.currency.iso_code == 'TWD' or cart.currency.iso_code == 'TSH' or cart.currency.iso_code == 'THB' or cart.currency.iso_code == 'UGX' or cart.currency.iso_code == 'KWD' -%}
{% if template contains 'product' %}
{%- assign fa_product_price = fa_current_variant.price | money_without_currency | remove:',' -%}
{% elsif template contains 'cart' %}
{%- assign fa_product_price = cart.total_price | money_without_currency | remove:',' -%}
{% endif %}
{%- else -%}
{% if template contains 'product' %}
{%- assign fa_product_price = fa_current_variant.price | money_without_currency | remove:'.' | replace: ',', '.' -%}
{% elsif template contains 'cart' %}
{%- assign fa_product_price = cart.total_price | money_without_currency | remove:'.' | replace: ',', '.' -%}
{% endif %}
{%- endif -%}

{%- if fa_product_id == 'default' -%}
{%- capture fa_product_id_value -%}shopify_{{ fa_product_id_alpha2_code }}_{{ product.id }}_{{ fa_current_variant.id }}{%- endcapture -%}
{%- elsif fa_product_id == 'product_id' -%}
{%- capture fa_product_id_value -%}{{ fa_current_variant.id }}{%- endcapture -%}
{%- elsif fa_product_id == 'parent_id' -%}
{%- capture fa_product_id_value -%}{{product.id }}{%- endcapture -%}
{%- elsif fa_product_id == 'sku' -%}
{%- capture fa_product_id_value -%}{{ fa_current_variant.sku }}{%- endcapture -%}
{%- endif -%}


<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'AW-{{ fa_google_ads_audience_tag_id }}');
</script>

{% if template contains 'collection' %}
{% assign fa_event = 'view_item_list' %}
{% elsif template contains 'product' %}
{% assign fa_event = 'view_item' %}
{% elsif template contains 'search' %}
{% assign fa_event = 'view_search_results' %}
{% elsif template contains 'cart' %}
{% assign fa_event = 'add_to_cart' %}
{% elsif template contains 'index' %}
{% assign fa_event = 'home' %}
{% else %}
{% assign fa_event = 'other' %}
{% endif %}

<script>
  gtag('event', '{{ fa_event }}', {
    'send_to': 'AW-{{ fa_google_ads_audience_tag_id }}',
  	  {% if template contains 'product' or template contains 'cart' %}'value': {{ fa_product_price }},{% endif %}
	{% if template contains 'product' %}
    'items': [{
			'id': '{{fa_product_id_value}}',
      'google_business_vertical': 'retail'
    }]
	{% elsif template contains 'cart' %}
	'items': [
	{% for item in cart.items %}
	{
		{% if fa_product_id == 'default' %}
			'id': 'shopify_{{ fa_product_id_alpha2_code }}_{{ item.product_id }}_{{ item.variant_id }}',
		{% elsif fa_product_id == 'product_id' %}
			'id': '{{ item.variant_id }}',
		{% elsif fa_product_id == 'parent_id' %}
			'id': '{{ item.product_id }}',
		{% elsif fa_product_id == 'sku' %}
			'id': '{{ item.sku }}',
		{% endif %}
      'google_business_vertical': 'retail'
    },
	{% endfor %}
	]
	{% endif %}
  });
</script>
<!-- Google Ads Remarketing Tag By FeedArmy Version 2.16 END -->

Now go to Settings > Checkout

Scroll down till you see Order Processing > Additional scripts

From the code example below, edit the value between code settings start and end. Do not change anything else or you might break the functionality. I have highlighted below what you can edit.

  1. Copy the below code into a text editor and replace the fa_google_ads_audience_tag_id value to your audience tag id
  2. By default the code is set up for the US, if you targeting a different country, change the value of fa_product_id_alpha2_code to your target country alpha2. For example, the United Kingdom is GB. You can find the full list here: https://help.shopify.com/en/api/custom-storefronts/storefront-api/reference/enum/countrycode
  3. The following step requires you to check the product id in Google Merchant Center > Products > List. And see what ID you are using.
    1. If it looks like shopify_US_81191654332_1055121650148, then keep fa_product_id set to default
    2. If it looks like 1055121650148 then set the value fa_product_id to product_id
    3. If it looks like the main id 81191654332 then set the value fa_product_id to parent_id
    4. If it looks like a sku then set the value fa_product_id to sku

When you completed the code paste it in the additional scripts settings and save.

<!-- Google Ads Remarketing Tag By FeedArmy Version 2.16 START -->
<!-- FeedArmy tutorial found at https://feedarmy.com/kb/adding-google-adwords-remarketing-tag-to-shopify/ -->

<!-- CODE SETTINGS START -->
<!-- CODE SETTINGS START -->

<!-- Please add your Google Ads Audience Source Tag ID -->
{% assign fa_google_ads_audience_tag_id = 696810292 %}

<!-- Please add your alpha2 code, you can find it here: https://help.shopify.com/en/api/custom-storefronts/storefront-api/reference/enum/countrycode -->
{% assign fa_product_id_alpha2_code = 'US' %}

<!-- set your product id values are default, product_id, parent_id, sku-->
{% assign fa_product_id = 'default' %}

<!-- CODE SETTINGS END -->
<!-- CODE SETTINGS END -->

<!-- ==================================== -->
<!-- DO NOT EDIT ANYTHING BELOW THIS LINE -->
{% if fa_google_coding %}{% assign fa_google_coding = true %}{%- else -%}{% assign fa_google_coding = false %}{%- endif -%}
{% if fa_google_coding == false %}
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-{{ fa_google_ads_audience_tag_id }}"></script>
{%- endif -%}
{%- if cart.currency.iso_code == 'GBP' or cart.currency.iso_code == 'USD' or cart.currency.iso_code == 'CAD' or cart.currency.iso_code == 'AUD' or cart.currency.iso_code == 'BWP' or cart.currency.iso_code == 'BND' or cart.currency.iso_code == 'DOP' or cart.currency.iso_code == 'GTQ' or cart.currency.iso_code == 'HKD' or cart.currency.iso_code == 'INR' or cart.currency.iso_code == 'ILS' or cart.currency.iso_code == 'YEN' or cart.currency.iso_code == 'KES' or cart.currency.iso_code == 'KOR' or cart.currency.iso_code == 'LBP' or cart.currency.iso_code == 'MYR' or cart.currency.iso_code == 'MXN' or cart.currency.iso_code == 'NPR' or cart.currency.iso_code == 'NZD' or cart.currency.iso_code == 'NIO' or cart.currency.iso_code == 'NGN' or cart.currency.iso_code == 'PKR' or cart.currency.iso_code == 'CNY' or cart.currency.iso_code == 'PHP' or cart.currency.iso_code == 'SGD' or cart.currency.iso_code == 'LKR' or cart.currency.iso_code == 'CHF' or cart.currency.iso_code == 'TWD' or cart.currency.iso_code == 'TSH' or cart.currency.iso_code == 'THB' or cart.currency.iso_code == 'UGX' or cart.currency.iso_code == 'KWD' -%}
{%- assign fa_product_price = checkout.total_price | money_without_currency | remove:',' -%}
{%- else -%}
{%- assign fa_product_price = checkout.total_price | money_without_currency | remove:'.' | replace: ',', '.' -%}
{%- endif -%}
{% assign fa_event = 'purchase' %}
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'AW-{{ fa_google_ads_audience_tag_id }}');
</script>
<!-- Global site tag (gtag.js) - Ads. -->
<script>
  gtag('event', '{{ fa_event }}', {
    'send_to': 'AW-{{ fa_google_ads_audience_tag_id }}',
	  'value': {{ fa_product_price }},
	  'items': [
	{% for item in checkout.line_items %}
	{
		{% if fa_product_id == 'default' %}
			'id': 'shopify_{{ fa_product_id_alpha2_code }}_{{ item.product_id }}_{{ item.variant_id }}',
		{% elsif fa_product_id == 'product_id' %}
			'id': '{{ item.variant_id }}',
		{% elsif fa_product_id == 'parent_id' %}
			'id': '{{ item.parent_id }}',
		{% elsif fa_product_id == 'sku' %}
			'id': '{{ item.sku }}',
		{% endif %}
      'google_business_vertical': 'retail'
    },
	{% endfor %}
	]

  });
</script>
<!-- Google Ads Remarketing Tag By FeedArmy Version 2.16 END -->

Checking The Results

Currently as of writing, Google Tag Assistant does not check which values are added in the gtag remarketing code. So you will need to look at the source code, to confirm.

Important!
Google Tag Assistant will show a red label if you have an ad blocker installed on your browser. Disable or remove the ad blocker to see a blue icon.

You can check the results manually by right-clicking on the product landing page then choose view page source and search for FeedArmy (ctrl+f), then simply check the values that are added. You should see something like below.

<!-- Google Ads Remarketing Tag By FeedArmy START -->
<!-- FeedArmy tutorial found at https://feedarmy.com/adding-google-adwords-remarketing-tag-to-shopify/ -->
<!-- Please add your Google Ads Audience Source Tag ID -->
<!-- Please add your alpha2 code, you can find it here: https://help.shopify.com/en/api/custom-storefronts/storefront-api/reference/enum/countrycode
<!-- set your product id values are default, product_id, parent_id, sku-->
<!-- ------------------------------------ -->
<!-- DO NOT EDIT ANYTHING BELOW THIS LINE -->
<!-- Global site tag (gtag.js) - Ads. -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-123456789"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'AW-123456789');
</script>
<!-- Global site tag (gtag.js) - Ads. -->
<script>
  gtag('event', 'view_item', {
    'send_to': 'AW-123456789',
	'value': 490.00,
    'items': [{
	'id': 'shopify_US_244465464459_214781237805',
        'google_business_vertical': 'retail'
    }]
  });
</script>
<!-- Google Ads Remarketing Tag By FeedArmy END -->

Creating Your Audience Lists

Some audience lists will be automatically created, so check what you already have.

After a few days, you can create website visitor audience lists using the data collected in the code above. To do this log in to Google Ads and from the top right corner, click on the wrench > Audience Manager > click on the blue plus sign and choose Website Visitor.

In the visited page section choose event from the drop down, then set the operator to equals and the value (in this example) view_item_list and click on Create Audience.

Here is a full list of event values

  • view_item_list
  • view_item
  • view_search_results
  • add_to_cart
  • index
  • purchase
  • other

You can also choose the rule for the following groups

  • event
  • google_business_vertical
  • id
  • value

Change Log

  • V2.15: Added Canada to the auto-detect list
  • V2.14: Fixed variants not listing the correct price

Need Help?

159 thoughts on “How To Add Google Ads Remarketing Tag To Shopify”

  1. My catalog is {{ item.product_id }}{{ item.variant_id }} . So I have to remove the shopify{{ fa_product_id_alpha2_code}}_ on default section in both liquid and checkout scripts right ?

  2. Hello, and thank you so much. I have a question, how can i implement this code in GTM? i tried to make an html tag but it doesnt works.

    Thanks.

      1. Hi, I did email to you, but I got message of address not found!! Could you please give me another email?

  3. Can I also create audience based on what product type the visiting customer added to cart?

    It would be great if you can please provide some examples on how the variables can be used.

    I just set up the code provided by you on my website and seems like it was installed correctly

  4. Thanks for this. I would suggest changing:
    <!-- ------------------------------------ -->
    to
    <!-- ==================================== -->
    Not a big deal, but Firefox warned that ‘Consecutive hyphens did not terminate a comment. “–” is not permitted inside a comment.’

  5. Hello, I applied the steps explained in this article and remarketing code seems working. However, Analytics code started to give “Same web property ID is tracked twice.” error when I review on Google Tag assistant. How can I resolve this?
    Thank you. https://uploads.disquscdn.com/images/509ce639dba6a850a4844a499521e66ea0f08f06e8643e40963b9eef2378dfe2.png https://uploads.disquscdn.com/images/9f3b20d132b80509d4582be49771329c5b9e9606dad4187af8863f4e538cf1d4.png

  6. Hey Emmanuel, thanks for your code, just a question that has been bothering me for the last few days.

    Situation: looking at the source of the pages of my website everything looks good, i see the firing happening and all the variable populated, the id is the same of the products on the merchant center

    here below an example with the google ads id removed for privacy




  7. https://uploads.disquscdn.com/images/ad1805bb1da6a7fb03e59ff3ae6c988581b99fe34b5e78e8238b05fd64a8af3b.jpg Hi emanuel, and here is the warning again… its always this in every store every google ads account… should i worry or not? thanks
    I think this appear to all… Just clear out if this is suposse to appear 🙂 I know that new version dont incklude ecomm prod id, but since google gives this warning, is just to confirm… also ofcorse “page event” dont have id… is because that? the confusion is because google says never receive ecom prod id, but if we are using new version, why google warn that? its wrong? best!

  8. Sérgio Chaves

    Emmanuel one question that i think is important to everyone… when creating audience, we should create by URL like “/products” or Event? like “view_item”? all the best!

    1. Hello Sergio. The new code is all based on the following parameters. Which are: event, google_business_vertical, id and value. So this means, it will be event like search or event like add_to_cart. I will add this info to the article this weekend. Thanks for pointing this out.

  9. Sérgio Chaves

    It’s all ok… but I have this warning every time…. Also another store and never worked ok… maybe just me…. thanks anyway.

  10. Sérgio Chaves

    hi emanuel and everybody, is just to me to get warning in audience “did not receive more than 92% of product id, not possible to personalize ads because not set up the right parameter to ID. ?? campaign stop running.

    1. Emmanuel Flossie

      That is possible when the remarketing code is not correctly installed. Double check your product landing page that it is working by viewing the source code, check the item id, and the event. Hope this helps.

  11. Keep rocking Emmanuel, all is working great :)by the way, iam using automatic audiences, and did a purchase test clicking AD, convertion count, but now is still showing and iam excluding past converters, should i create manually a list of past converters instead automatic one?

    1. Emmanuel Flossie

      Hello Sergio, thank you for the kind words. If you want to setup a manual list, yes sure go ahead. Using manual setups allows you to fine tune your remarketing. However if the list becomes too small it tends to not work. So experiment and see how it goes.

  12. Emanuel, why tag assistance always fail remarkting tag when try validate merchant ID? the product ID is corrected between merchant and tag. is that normal? i think i can ignore that tag assistance validation, but let me know.

      1. yeah, google still use that warning even with google shoppig app tags, google is very complex and all bugged warnings haha

      1. This is mentioned in this article under, Checking The Results. Google Tag Manager has issues finding info on the page. So if you want to check if everything is correct. Use source code to view the data and compare.

  13. Cormac O'Síocháin

    With this point though, “Copy the below code into a text editor and replace the fa_google_ads_audience_tag_id value to your audience tag id”, I couldn’t find an audience tag id anywhere without creating a list. Is there a generic audience tag id associated with every individual Google Ads account, and where do I find it?

    1. I see where the confusion is, please follow step 1 to get the audience tag id. This has nothing to do with audience lists. If you still continue to have issues, email me [email protected] as I also offer an installation service.

    1. As far as I know, that does not exist. When you followed my guide, Google will automatically generate all retail audience lists. You can indeed also create your own audience lists. In this case you need to setup custom rules.

    1. Hello, Audience lists for cart and orders are automatically generated. So you do not need to create another list. If you installed my code above.

  14. It looks like the product_id is just the top level product id. Is there are way to use the variant id? I believe in the older version of this code you had a available it was something like product.variants.first.id

  15. Hello so I have a id that looks like this 2492510306364_22355641794620 without the shopify_US how do I support this?

        1. Emmanuel Flossie

          That is correct Sergio, so when you already have a global tag, no need to install it again, just the rest of the code.

          1. great! and now the last question, this line of code: // {{ checkout.total_price | money_without_currency | remove:’,’ }}this makes on checkout page appear text example, if checkout is total 12, on checkout page will appear text ” // 12 “this line is necessary or is a bug in code? let me know please. thank you :)its on checkout code here, i thinks this is to remove that line of code, but let me know<script async=”” src=”https://www.googletagmanage…{{ fa_google_ads_audience_tag_id }}”></script><script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(‘js’, new Date()); gtag(‘config’, ‘AW-{{ fa_google_ads_audience_tag_id }}’);</script>{% if fa_prices_with_decimal_separator == true %}{% assign fa_product_price = checkout.total_price | money_without_currency | remove:’,’ %}{% else %}{% assign fa_product_price = checkout.total_price | money_without_currency | remove:’.’ | replace: ‘,’, ‘.’ %}{% endif %}this one —->>>> // {{ checkout.total_price | money_without_currency | remove:’,’ }} <<<—————— this one{% assign fa_event = ‘purchase’ %}<script>

          2. its on checkout code here, i thinks this is to remove that line of code, but let me know<script async=”” src=”https://www.googletagmanage…{{ fa_google_ads_audience_tag_id }}”></script><script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(‘js’, new Date()); gtag(‘config’, ‘AW-{{ fa_google_ads_audience_tag_id }}’);</script>{% if fa_prices_with_decimal_separator == true %}{% assign fa_product_price = checkout.total_price | money_without_currency | remove:’,’ %}{% else %}{% assign fa_product_price = checkout.total_price | money_without_currency | remove:’.’ | replace: ‘,’, ‘.’ %}{% endif %}this one —->>>> // {{ checkout.total_price | money_without_currency | remove:’,’ }} <<<—————— this one{% assign fa_event = ‘purchase’ %}<script>

          3. help me here my friend. that line of code makes my checkout amount (text) on order page for customers, and is not suposed… hehe i have to delete that line? let me know 🙂

  16. Hello, I’m using google shopping in conjunction with your given code will this interfere with my remarketing tag that you provide? Its detecting I have two gtags as will the remarting validation is stating “Some products are not valid” but when I check the code that you provide it is working.

    1. Emmanuel Flossie

      1) Make sure that you have only one remarketing code installed as otherwise it will cause confusion and make inaccurate tracking. Remove any old installations.2) The remarketing code is designed for eCommerce to work with Google Ads, Campaign Audiences and Display Ads. So no conflict.3) When you install new code, you need to wait a few days for Google to catch up, it may take up to several weeks as Google does not check every page every day.Kind regards, Emmanuel.

  17. Hi, I’ve done the application as you specified, but what could be the reason why the adwords panel counts as 2 times the conversions?

  18. Hi, First of all thank you very much for this article, it really helped me setup all the tags.I would like to know of its possible for you to update the article since the snippet for new accounts have change.The new one looks like this<script> gtag(‘event’, ‘page_view’, { ‘send_to’: ‘xx-123456789’, ‘value’: ‘replace with value’, ‘items’: [{ ‘id’: ‘replace with value’, ‘google_business_vertical’: ‘retail’ }] });</script>Thank you in advance

  19. Hi Emmanuel,I’ve streamlined some of this code here:https://github.com/Czarto/ShopifyScripts/blob/master/snippets/adwords-remarketing.liquidAs well as the code to include in the “Additional Checkout Scripts” settings here (including AdWords conversion tracking):https://github.com/Czarto/ShopifyScripts/blob/master/settings/checkout/adwords-conversion.liquidBoth of these allow you to specify your Google conversion Id at the top, and dynamically switches the product Id based on store currency (CAD, USD, and AUD for now, but simple to add more as needed)Best,Alex

  20. Hey Emmanuel, many thanks for writing this. I followed everything to the T and have the following errors in my Google Ads Tag > Audience Sources (https://www.dropbox.com/s/j…. Are they to be ignored?Also, I accidentally clicked both Custom and Retail as business types and I can’t seem to go back and de-select Custom—do you know a way to rectify this?

    1. Make sure you wait at least 30 days, as installing it and checking Google Ads instantly will not give Google enough time to update the list. Yes some pages will not have a product id, that is normal. I’m unsure if checking custom will have a negative effect, I recommend you contact Google directly.

  21. Did shopify or google just change something? My google ads account is saying I have a few errors and got me stumbling across this article. Great info, but I wish it had a changelog at the top saying what you updated, on what day, and why it got updated. Like this:January 31st, 2019 – Change step 6 from this to that. – Why? Because google or shopify changed something on their end and didn’t tell anyone.Thanks!

  22. I have an update, so I have replaced “remove:’,'” with replace: ‘,’, ‘.’ in all the scripts (in theme.liquid, cart and checkout) and my remarketing stopped showing. Would you know why is that? Thank you! 🙂

  23. THANK YOU! I just didn’t noticed the second tab at all. Thanks a lot, it all works now. This article and your help is brilliant. The world needs more people like you! Have a nice day.

  24. Hi, thank you for your answer! I am sorry, I didn’t really understand – what should I flip around? I see in the code that there is: remove:’,’ – shouldn’t I take this bit out of the code to make the price work correctly?{% if template contains ‘product’ %}’ecomm_totalvalue’: {{ product.price_min | money_without_currency | remove:’,’ }}{% endif %}I am not very experienced so I am just guessing 🙂 Thank you for your help.

    1. Go to step 8, then click on the tab, prices with comma separator, copy the code and place it in cart.liquid file. Hope this helps. I updated the tutorial so that you can select the correct code for the correct price delimiter.

  25. Hello, thank you for this great guide! My shopify store uses an ajax cart. I used google tag manager to check that the remarketing tag was installed correctly. If I click onto the “cart” page the google remarketing tag is installed correctly, however since I’m using an ajax cart the remarketing tag doesn’t seem to be firing for add to cart. Can you please advise how to update code for ajax cart? Thanks!

    1. Emmanuel Flossie

      Pleasure, you need to use the code with comma separator. Looking at my wording it seems the titles for the tabs for the two different codes are backwards, so I flip them around. Please click on the second tab. Because commas are not allowed, we need to replace the comma with a dot. And apologies for the incorrect labeling.

      1. Emmanuel Flossie

        Hello Robin, that is something I can not assist with. I recommend you contact the developer who created the cart, to assist.

  26. Hello, thank you SO MUCH for this manual. It really helped me! I only have one issue: example my product price is 7,54EUR, the totalvalue is showing as 754. What could I do about this? Thank you very much.

  27. You have the code as shown below’ecomm_totalvalue’: {{ checkout.total_price | money_without_currency | remove:’,’ }} });</script>Should it be like this?’ecomm_totalvalue’: ‘{{ checkout.total_price | money_without_currency | remove:’,’ }}’ });</script>With the variable for the total price being enclosed in ‘ ‘That’s how I had it set up and just wanting to double check before I change it. As one of shopify’s tutorials has it enclosed with ‘ ‘.Thanks in advance.

    1. Emmanuel Flossie

      Hello Aaron, numeric values are integers, these integers can never be a string value. When you have a value in quotes or double quotes, it changes to a string value. Which for prices cannot be done or it is flagged as an invalid value.If you are interested in learning more : https://developers.google.c…Hope this helps.

  28. Laetitia Guilbaud

    Hi,How do you do to track multiple ecomm_prodid on collection or category pages ? What is the code please ? Thank you

  29. Hi,Great article.I have used your code as advised and specifically used the sku code to the relevant product ID through against ‘ecomm_prodid’, as in my Google Merchant Centre Feed, this uses the SKU’s against each of my products.I ran a test as advised above by looking at the ‘view page source’ and all seems to pull through correctly e.g. view-source:https://www.morrisrichardso…But…When using the Google Tag Assistant, it shows ‘some products are not valid’. There is also the error flagged against my Google Ads tag in Adwords that ‘Your Google Ads tag is missing “product ID”.But I cannot understand this as, when testing the remarketing code by using the Google Tag Assistant, it does successfully show the correct product ID against the ‘ecomm_prodid’ which also matches the Item ID in my Google Merchant Centre.Your help would be very highly appreciated.Many thanks,Tom

  30. Hi,Thanks for that procedure that works way better than a lot of others.On point 7, do we need the [ ] for prod_id ? they are not there on the other steps. Thanks!Flo

    1. Emmanuel Flossie

      Yes you do, this if the customer bought multiple products then this needs to be enclosed in straight brackets. Hope this helps.

  31. <script> gtag(‘event’, ‘page_view’, { ‘send_to’: ‘AW-XXXXXXXX’, ‘ecomm_pagetype’: ‘replace with value’, ‘ecomm_prodid’: ‘replace with value’, ‘ecomm_totalvalue’: ‘replace with value’, ‘user_id’: ‘replace with value’ });</script>That is google ads new structure. What should i replace with “user_id”?And please can you update code structure for new Google AdsThanks in advance.

    1. Thank you for your response. I have seen other shopify stores running dynamic re-marketing campaigns, how are they doing it without the “user_id”? Cause “user_id” is required for cross device linking and cross device linking is required for dynamic re-marketing.

      1. You do not need user id, Google uses cookies, email, user logins and other sources to cross device users. So if user id is required, then you would not be able to disable the function. So if you want Shopify to support this, ask them to implement the hook. Hope this helps.

  32. Currently it seems that Shopify does not have a user id liquid hook, so you can not use it. Contact Shopify to request for them to add this feature.

  33. You can only do that if you have different Shopify stores. If you have 1 store, then you submit the same feed data to other target countries. So you need to use the default country code. If for example it is UK, then submit shopify_UK_132465798132_3132465179813. You can read the article in the link below which explains this in more details. https://feedarmy.com/kb/how

  34. Any idea how to use the ‘user_id’ parameter that can be utilized as part of the new Google Signals? This seems impossible to do in Shopify if the gtag snippet is loaded in the <head> tag.

  35. Hi Emmanuel, Excellent tutorial I have a question, how can I integrate the code when I have products in different Google Stores (US, AU, UK) ? and in each store the Product ID is different?shopify_UK_132465798132_3132465179813, shopify_US_132465798132_3132465179813shopify_AU_132465798132_3132465179813Thanks

    1. I have setup GA and track conversion following instruction from Shopify, so I already added Global Site Tag for GA AW in theme.liquid. Will step 6 conflict my existing code because there will be 2 global site tag? I’m using combined Global Site Tag in theme.liquid like:….. gtag( ‘config’, ‘UA_TRACKING_ID’); gtag( ‘config’, ‘AW-CONVERSION_ID’);</script>https://help.shopify.com/enhttps://help.shopify.com/en

      1. Emmanuel Flossie

        In this case, you can remove the global site tag from my script or your script. There will be no conflict if you leave it. However the script will load twice for no reason. So it is best to just have one global tag per page. Hope this helps.

  36. Emmanuel Flossie

    Hello Mark, thank for the message. I have updated the article to include the code for comma separators.

    1. Thanks Emmanuel. There must be something a little wrong though, now it does not display the ‘ecomm_totalvalue’ row at all when I view source in the cart, just the page type and prod id.it displays on the shop, but not on the cart. Have emailed you the cart source, thanks

      1. UPDATE: works in the shop page, not on the cart. when i view source, this is the info about totals I see in case it helps: <div class=”cart-totals”> 128,00 zl Wyłączając podatek i przesyłkę. <input class=”cart-button-update button secondary” type=”submit” name=”update” value=”Zaktualizuj”> <input class=”cart-button-checkout button” type=”submit” name=”checkout” value=”Zamów”>

        1. I’ve resolved the issue by just adding this line in the script:’ecomm_totalvalue’: {{ cart.total_price | money_without_currency | remove:’,’ }}

          1. Emmanuel Flossie

            Hi, sorry about that, it looks like I left behind a test code to check if the price had a comma. Please check the tutorial again as I have updated this.

  37. Thanks for this Emmanuel. I have it setup correctly on my UK site. I am trying to setup on my Polish site. Have used same code (different adwords account though) but updated to shopify_PL in the script. I am having difficult with the ecomm_totalvalue. As an example in the UK it would show ‘ecomm_totalvalue’: 31.47 as the value, but on the Polish site when I view source I can see ‘ecomm_totalvalue’: 5400 – there is no seperator for the decimalI think there is a problem as Polish Zloty uses a ‘,’ instead of a decimal. Do you know what I should update the script to? Many Thanks

  38. Sorry Luong, I honestly can’t remember exactly what I did but I got it working. I found out the correct identifier to use and just went with that I think. Did you get it sorted?

  39. @Emmanuel Flossie is there a way I can reach you directly?I am using for the iDs in merchant center the SKU that I add for Variants

  40. Emmanuel Flossie

    Hi and thanks for the comments.The product ID always needs to match, otherwise the dynamic remarketing will not work. If you provide me with a sample of product id’s Google Merchant Center has, I will then guide you which product id code you need in Shopify.

  41. Hey Dale. Did you fix this? I’m having the same problem as you. Can give me some advices. Thanks so much

    1. Emmanuel Flossie

      Hi Luong, as mentioned before, you need to select retail from the business type, when you setup the remarketing code. Follow the tutorial from the beginning and you see there is a section that requires you to follow this. Hope it helps.

  42. @@FeedArmy:disqus first thank you! this is a great tutorial,I followed all your instructions, but I am using a third party program to submit my products to merchant center, my question is, with that in mind should the validation for the product ID always fail? is taht how it is supposed to be?

  43. Emmanuel, I actually had a 4th question as well 🙂
    In step 8, the code for checkout is:
    ‘ecomm_prodid’: [{% for item in checkout.line_items %}’shopify_GB_{{ item.product_id }}_{{ item.variant_id }}’,{% endfor %}],

    But the last part, for using SKU’s as Product ID, step 8 only, you write that the line should be changed to:
    ‘ecomm_prodid’:[{% for item in checkout.items %}'{{ item.sku}}’,{% endfor %}],

    Shouldn’t this one also be checkout.line_items instead of checkout.items ?

  44. Thank you for the comprehensive guide.

    I have 3 questions:

    1)
    According to Google’s Adwords support and guidelines, the snippet code should be pasted into the section, which is possible to do in the theme.liquid file. But in your tutorial, under step 6 for the new AdWords UI, you write that the snippet code should be pasted in at the bottom of theme.liquid file, just before the tag. Is there any reason that you want the code to be pasted before and not within section?

    For Cart.liquid it is different. It doesn’t have any tag, hence I have pasted the code snippet at the bottom just before .

    2)
    According to your guide, in Step 8, the Remarketing code snippet should be pasted in the “Additional Scripts” field under “Settings > Checkout” in “Settings” menu. Here I have already a conversion code tag. Should the Remarketing code be pasted under the existing Conversion code?

    My existing code in the “Additional Scripts” field (account IDs are masked):


    https://www.googletagmanager.com/gtag/js?id=11-111111111

    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag(‘js’, new Date());

    gtag(‘config’, ’11-111111111′);

    gtag(‘event’, ‘conversion’, {
    ‘send_to’: ’11-111111111/Xxx-Xxxxxxxxxx-Xxxx’,
    ‘value’: {{ total_price | money_without_currency | remove:’,’ }},
    ‘currency’: ‘DKK’,
    ‘transaction_id’: ‘{{ order.order_number }}’
    });

    3)
    In the code line ‘ecomm_totalvalue’, you are removing the comma in the price (remove:’,’). What is the reason for that?

  45. I have been getting traffic to my store which have been viewing product without buying.

    I have verified that I setup my remarketing tags exactly as described and cross-referenced with other articles, however, my automatically create remarketing list by google:
    Product viewers (Retail) (AdWords)
    People who viewed specific product pages on your site but did not create a shopping cart

    is not increasing in size at all.

    Can you please help me with this?

  46. Thank you so much for this.

    Have been looking all over the internet for something that explains what you just explained perfectly.

    The only thing I am confused about is how to determine if I am using a simple identifier or sku as a product id ?

      1. Hey Emmanuel,
        Thank you so much for these really detailed instructions. I’m having trouble getting mine to work unfortunately and am just troubleshooting at the moment. My question is, in the data feed (which i’m assuming is the export of products from the ‘products’ page in shopify) which column are you referring to as the product id? I’ve tried all three options (original code, SKU, and simple prod id) and am receiving errors in google tag manager for all three. I’m not sure what to try next. Would you have any idea?

        Thanks in advance,
        Dale.

          1. Cheers for the prompt reply! Greatly appreciated. My believe my issue was that I only had one product in Google merchant centre . . . I set this up a while ago and forgot about it. I’ll add the rest now and hope all’s well.

            Thanks again.

          2. Hi Emmanuel,

            My google tag manager is throwing an error saying “Some products are not valid”. I believe I am using the correct code for the product ID (the default code for standard shopify application).

            For example, one product in my merchant center has the product id: “shopify_AU_8106466179_26275677123”. The first series of numbers, “8106466179” are the numbers that appear in the URL bar when I go to that product in the shopify admin section. However, i’m not sure where the last series of numbers in the google merchant center product id, “26275677123” come from.

            Are you able to confirm that this product id which i’m seeing in the merchant center is the standard shopify application? Or is this a simple product id? I know it’s definitely not the sku.

            Your help is greatly appreciated. Thank you so much for this code.


          3. Hi Emmanuel,

            Hope you’re well.

            In my Google Adwords status review for display campaigns, i’m receiving the following error message:

            1 campaign is missing audience sources for your business types.
            To help personalise ads based on user actions, set up custom parameters for business type: “Retail” in your Google Analytics tag.

            It was my understanding that the above code added the customer parameters. Is Google just taking it’s time to update, or would you think there’s still an issue with my setup? I’ve also tried to view these ads myself by acting as a customer, but can’t seem to find any display ads from remarketing on my browsers, no matter how hard i try.

            Thanks again,
            Dale.

    1. Use Chrome Tag Assistant to check if it works.
      It is best to use the type of audience you want to target, be it from Adwords remarketing or Analytics. Think about who you want to target, than use what is appropriate to achieve your plan.

  47. Hi Emmanuell,
    I used the Shopify’s default id’s, so for exemple in the ecomm_prodid line I have to use ecomm_prodid: {{ id }} ????
    because in the importan info you wrote that if someone is ” using a tool that uses Shopify’s default id’s, than use the default code.”

    cheers
    luca

    1. First check what the product id is in the data feed, if its default than use the code I have already prepared. Which is (example code) shopify_GB_{{ item.product_id }}_{{ item.variant_id }} If you are unsure about what to do, send me an email and I can set it up for you correctly.

  48. Hi guys,

    Where I have to paste the code into cart.liquid , because I don’t see the closing body tag…Does it work if I paste it at the end of the page after all the code ? Because I’ve tried to paste it exactly at the end of all the code in cart.liquid, but Google Tag Assistent tells me that the code it’s implemented correctly but ” Code should be placed directly above the closing tag. ” Thank you in advance.

    1. Hello Luca, there is no closing body tag in cart.liquid. Simply paste to code at the bottom of the file. I can see the same issue myself, however the code is placed above the closing body tag. So I have no further info on resolving this. I think Tag Assistant has some bugs.

      1. Ok Emmanuel, thank you very much for your answer. So if I’ve pasted this code exactly at the end of all the code in cart.liquid , have I done the right thing? thank you.

      1. Where I have to paste the code into cart.liquid , because I don’t see the body tag…at the end of the page after all the code? thank you

  49. Additionally, the comma should be removed from the end of the ecomm_totalvalue parameter, as it is invalid javascript syntax and results in javascript errors.

    1. Hello Brian, a trailing commas is only invalid for old browsers pre 2007. As we are in 2017 browsers have been modernized to not flag this as a syntax error. You can remove the trailing comma from your code if you wish to do so, but there is no point. The script is valid syntax for all modern browsers.

  50. It would appear there are two other errors with this script.

    1) Look at line 1 in the theme.liquid snippet. “product” should instead be ‘product’. Single quotes instead of double quotes.
    2) You ought to alter the prices so that prices such as “1,500” aren’t being broken into two separate pieces, “1” and “500”. Try this instead
    {{ product.price_min | money_without_currency | remove: ‘,’ }}

    1. Hello Brian,
      1) Single quotes or double quotes do not change the way the code acts. They act the same way. This is only important if you want to include double quotes as a variable value, which than can be done by encapsulating it with single quotes, or visa versa.
      2) Thank you, this is updated

  51. To confirm, you need to add the remarketing code with the updated shopify product ID and conversion ID to all three files: theme.liquid, cart.liquid and the additional script under order processing?

  52. Will this send through multiple product ids through on a cart page if they’ve added more than one item, or just the first product id on the page?

      1. Thanks for the quick update! This is a fantastic solution to a complication I’ve been working to solve for the past couple weeks. It’s much appreciated!

      2. Are you sure about {% for item in checkout.items %}. Didn’t work for us, and it’s not in the Shopify doc. So we updated to checkout.line_items and it worked… (But I also recall seeing checkout.items somewhere…
        Kind of strange.

        1. Hello Jordy, thank you very much for taking to time to let me know. I have looked at the documentation and it seems that .items is only when you call cart.items, but for the checkout its indeed checkout.line_items. I thought I read it was the same, I must have overlooked the docs. Again thank you, this will help others get it right too. This article has now been updated.

          1. Good. Thanks for the prompt feedback.
            We might have read the same misleading info/blog post, because I was convinced of the same thing !
            Anyway, better to stick with the doc standards.

  53. Agung Ridwan Syahputra

    Hello!

    I have been trying to use this code and did some manipulation as I am using Shopify Google Shopping, Merchant Center is linked, yet my tag assistant says some product is not valid. Can you help me out? https://uploads.disquscdn.com/images/2011cf5aad55bae3ebdeb9a15bfaac9378d749eb5874592ab6a3769e295afa3d.png

    Code deployed:

    {% if template contains “product” or template contains ‘collection’ or template contains ‘index’ or template contains ‘search’ %}

    var google_tag_params = {
    {% if template contains ‘product’ %}ecomm_prodid: ‘shopify_US_{{ product.id }}_{{ product.variants.first.id }}’,{% endif %}
    ecomm_pagetype: ‘{% if template contains ‘collection’ %}category{% elsif template contains ‘index’ %}home{% elsif template contains ‘search’ %}searchresults{% else %}{{ template }}{% endif %}’,
    {% if template contains ‘product’ %}ecomm_totalvalue: {{ product.price_min | money_without_currency }},{% endif %}
    };

    /* */

    //www.googleadservices.com/pagead/conversion.js

    {% endif %}

    1. Make sure the product ID matches that of the product ID in the data feed, if you are using a 3rd party plugin or some other tool you need to match the id in the javascript to that of the data feed.

      This tutorial is based on assuming you are using Shopify’s official identifiers.

      Hope it helps

      1. Agung Ridwan Syahputra

        Hello Emmanuel,

        Thanks for the response, I am indeed using official Google Shopping API in Shopify. After removing the merchant id in the tag assistant, it seems that the tag is working yet I found a message “To validate please enter the feed ID”.

        In addition, adwords gave me notification as follows:

        https://uploads.disquscdn.com/images/fdca8b5b05339f5ad3ddf21a99bfa43b5d2452a5f87326422b83e5cc5b3ccde3.png

        Do you know why it gives me this warning?

        1. If you have excluded products from the Shopify API than you will get this error. Because remarketing tag will see all products on the website, but if you excluded 1 product from the data feed, you will get an error that some products are missing. I recommend sampling the 10 examples given by Google Adwords and check if they are indeed missing from the data feed. If so, simply ignore the warning. With regards to validating with the feed ID, make sure the product you are checking is indeed in the product list of the merchant account. If you are still stuck ether contact Google Adwords or you can contact me to validate everything [email protected]

          1. I’ve got a similar problem like Agung. The code works PERFECTLY in every single product page, green label of google tag manager, but in the Homepage, and in Men and Women Collection I’ve got the same error message displayed in this image…. my product ID on shopify and the product ID in the data feed are the same ( in every single product page everything works fine, no problems).If I remove my merchant ID in the tag assistant, the tag seems working. Could you help me to understand why?

          2. It takes 72 hours for Google Adwords logs to update. As you have only installed it yesterday, you have not waited long enough. Further more I personally ignore this message as I have no further info to resolve this. I recommend you contact Google directly.

          3. Ok Emmanuel, thank you.
            The tag works perfectly in every single product page ; while on the homepage, men and women collection doesn’t work….Remarketing with adwords will work even if there is this warning?

    2. I’ve got a similar problem like Agung. The code works PERFECTLY in every single product page, green label of google tag manager, but in the Homepage, and in Men and Women Collection I’ve got the same error message displayed in this image…. my product ID on shopify and the product ID in the data feed are the same ( in every single product page everything works fine, no problems).If I remove my merchant ID in the tag assistant, the tag seems working. Could you help me to understand why?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.