How To Setup AdWords Dynamic Remarketing in Shopify?

Shopify Google AdWords Dynamic Remarketing Setup

If you are stuck at setting up Google Ads (AdWords) Dynamic Remarketing scripts in your Shopify store, this simple guide will help you do it easily.

Without much ado, let me take you straight to the process…

  1. Step 1: Add a new Snippet for AdWords Dynamic Remarketing 
  2. Step 2: Call the Snippet you created in the theme file
  3. Step 3: Test your setup

Yes, you will only need to take just three simple steps. However, a bit of minute attention may be required so that you don’t break anything. Grab your coffee if it helps you to be attentive! Let’s get started…

Step 1: Add a new Snippet for Google Ads Dynamic Remarketing

  • Login to Shopify and go to Online Store > Themes > Edit HTML/CSS
  • Scroll to the bottom to the Snippet section in the left navigation bar
  • Click ‘Add a new snippet’ and give it name – adwords-dynamic-remarketing
  • Paste the codes below and Save it.
  • Make sure to change the Conversion ID, AW-000000. You will need to go to your Google Ads account to set up a conversion action for Sales. Note the conversion ID from the code that Google gives you.

<!-- Global site tag (gtag.js) - Google Ads: 000000 -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-000000"></script>
<script>
 window.dataLayer = window.dataLayer || [];
 function gtag(){dataLayer.push(arguments);}
 gtag('js', new Date());<!-- Event snippet for dynamic remarketing -->gtag('config', 'AW-000000');
</script>
{% if template contains 'index' %}
<script>
 gtag('event', 'page_view', {
 'send_to': 'AW-000000',
 'ecomm_pagetype': 'home'
 });
</script>
{% elsif template contains 'collection' %}
<script>
 gtag('event', 'view_item_list', {
 'send_to': 'AW-000000',
 'ecomm_pagetype': 'category'
 });
</script>
{% elsif template contains 'product' %}
<script>
 gtag('event', 'view_item', {
 'send_to': 'AW-000000',
 'ecomm_pagetype': 'product',
 'ecomm_prodid': '{{ product.id }}',
 'ecomm_totalvalue': '{{ product.price | money_without_currency | remove: ',' }}'
 });
</script>
{% elsif template contains 'cart' %}
<script>
 gtag('event', 'view_cart', {
 'send_to': 'AW-000000',
 'ecomm_pagetype': 'cart',
 'ecomm_prodid': [{% for item in cart.items %}'{{item.product.id}}'{% unless forloop.last %},{% endunless %}{% endfor %}],
 'ecomm_totalvalue': '{{cart.total_price | money_without_currency | remove: ',' }}'
 });
</script>
{% elsif template contains 'search' %}
<script>
 gtag('event', 'view_search_results', {
 'send_to': 'AW-000000',
 'ecomm_pagetype': 'searchresults'
 });
</script>
{% else %}
<script>
 gtag('event', 'page_view', {
 'send_to': 'AW-000000',
 'ecomm_pagetype': 'other'
 });
</script>
{% endif %}

 


Step 2: Call the Snippet you created in the theme file

  • Go to Shopify admin, Online Store > Themes.
  • Click Actions > Edit code.
  • Paste the code below, try placing it near the top part of the <head> section.
  • Now, Save it.

The following code goes in the Theme.liquid file :

<!-- Google AdWords Dynamic Remarketing -->
{% include 'adwords-dynamic-remarketing' %}
  • And now Save it.

Next, you need to add the remarketing codes to your final order confirmation page as well so that the AdWords (Google Ads) system has insights about your sales.

Head to Settings > Checkout > Additional Scripts

Add the following script:

(Do not forget to change the Google Ads Conversion ID):


{% if first_time_accessed %}
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-000000"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'AW-000000');
</script>
<script>
gtag('event', 'purchase', {
'send_to': 'AW-000000',
'ecomm_pagetype': 'purchase',
'ecomm_prodid': [{% for item in checkout.line_items %}'{{line_item.sku}}',{% endfor %}],
'ecomm_totalvalue': {{ checkout.total_price | money_without_currency | remove:',' }}
});
</script>
{% endif %}

Congrats! You’re done.

Now download and install Google Tag Assistant Plugin for Chrome browser. Go to your website, enable the plugin and check the script. It should be working well.

If you come across any issue or have any feedback, feel free to post it in the comment section below.

And yes, if someone you think needs help on how to setup AdWords Dynamic Remarketing in Shopify, you can share this post. :)

Sharing is caring!

About the author

9 thoughts on “How To Setup AdWords Dynamic Remarketing in Shopify?”

  1. it is a wonderful snap,I am looking for it
    By the way,How can have the audience list (searchresult) displayed in google ads
    default there are only shopping cart abandoners and past buyers

    1. It won’t be readily available. You need to create that list. If you have linked your Google Analytics and Google Ads accounts, any Audience list that you create in Analytics will be available in Google Ads as well. Go ahead and create a specific list for the audiences who used search on your site.

  2. I have followed above mentioned steps and now in my google ads account ecom_prodid parameter is showing in Audience sources menu. i think it is working very well but i want know that how many day it takes to solve erroe that “Issue: ecomm_prodid never received”.

  3. Reinier van der Poel

    Hi Ratan, thanks for the explanation. Question why do we remove the “,” in the piece of code ‘ecomm_totalvalue’: {{ checkout.total_price | money_without_currency | remove:’,’ }} ? This way my product values values are multiplied by x100? What would be the line of code if we don’t want to remove the “,”? Apart from that many thanks for the explanation very helpful.

    1. If you are talking about removing “,” where the line lasts, that’s how JS is written, the last line won’t have the comma. Your product value won’t be multiplied by 100. Let one Sale happen and check it.

  4. Thank you! But I got two questions left.

    1) Do I leave the conversion snipped in the checkout scrip beside the snipped for dynamic remarketing?

    2) Do I remove the global site tag, when I already had it implement in theme.liquid?

Saying something!

Stay Updated, Subscribe.

About

A full-stack Digital Marketing Strategist with over a decade of experience, Ratan Jha has helped brands of every size scale up to the next levels.

Why work with random campaigns when you can have winning strategies in place? He can help you make your marketing efforts more rewarding with noticeable improvements in your KPIs… read more

Connect

Scroll to Top