An easy step by step guide on how to add Google Ads remarketing tag to Shopify using the latest features.
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
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.
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.
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.13 START -->
<!-- FeedArmy tutorial found at https://feedarmy.com/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' %}
<!-- if you have prices such as 1,000.00 set below to true, if you have prices such as 1.000,00 set below to false -->
{% assign fa_prices_with_decimal_separator = true %}
<!-- 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 -->
<!-- Global site tag (gtag.js) - Ads. -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-{{ 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>
<!-- Global site tag (gtag.js) - Ads. -->
{% if fa_prices_with_decimal_separator == true %}
{% if template contains 'product' %}
{% assign fa_product_price = product.price_min | 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 = product.price_min | money_without_currency | remove:'.' | replace: ',', '.' %}
{% elsif template contains 'cart' %}
{% assign fa_product_price = cart.total_price | money_without_currency | remove:'.' | replace: ',', '.' %}
{% endif %}
{% endif %}
{% 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': [{
{% if fa_product_id == 'default' %}
'id': 'shopify_{{ fa_product_id_alpha2_code }}_{{ product.id }}_{% if product.variants.first.id %}{{ product.variants.first.id }}{% else %}{{ product.variants.id }}{% endif %}',
{% elsif fa_product_id == 'product_id' %}
'id': '{% if product.variants.first.id %}{{ product.variants.first.id }}{% else %}{{ product.variants.id }}{% endif %}',
{% elsif fa_product_id == 'parent_id' %}
'id': '{{ product.id }}',
{% elsif fa_product_id == 'sku' %}
'id': '{% if product.variants.first.id %}{{ product.variants.first.sku }}{% else %}{{ product.variants.sku }}{% endif %}',
{% endif %}
'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.13 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.
When you completed the code paste it in the additional scripts settings and save.
<!-- Google Ads Remarketing Tag By FeedArmy Version 2.13 START -->
<!-- FeedArmy tutorial found at https://feedarmy.com/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' %}
<!-- if you have prices such as 1,000.00 set below to true, if you have prices such as 1.000,00 set below to false -->
{% assign fa_prices_with_decimal_separator = true %}
<!-- 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 -->
<!-- Global site tag (gtag.js) - Ads. -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-{{ 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>
<!-- Global site tag (gtag.js) - Ads. -->
{% 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 %}
{% assign fa_event = 'purchase' %}
<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.13 END -->
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
<!-- if you have prices such as 1,000.00 set below to true, if you have prices such as 1.000,00 set below to false -->
<!-- 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 -->
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
You can also choose the rule for the following groups