How To Setup AdWords Dynamic Remarketing in Shopify?

Shopify Google AdWords Dynamic Remarketing Setup

If you are stuck at setting up Google 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 AdWords Dynamic Remarketing

  • Login to Shopify and go to Online Store > Themes > Edit HTML/CSS
  • Scroll to 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, Currency, and Country Code. You will need to go to your AdWords to set up a conversion action for Sales. Note the conversion ID from the code that Google gives you. The Currency and Country Code should match your store’s settings.

Codes to be pasted before the closing </ body> tag:


{% comment %} Enter your google conversion id below {% endcomment %}
{% assign google_conversion_id = 0 %}
{% assign shopify_store_country = 'US' %}
{% if shop.currency == 'CAD' %}
{% assign shopify_store_country = 'CA' %}
{% endif %}
<script type="text/javascript">
 {% if template contains 'cart' %}
 var google_tag_params = {
 ecomm_prodid: [{% for item in cart.items %}'shopify_{{ shopify_store_country }}_{{ item.product.id }}_{{ item.variant.id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}],
 ecomm_pagetype: 'cart',
 ecomm_totalvalue: {{ cart.total_price | money_without_currency | remove: ',' }}
 };
 {% elsif template contains 'collection' %}
 var google_tag_params = {
 ecomm_prodid: [{% for item in collection.products limit:5 %}'shopify_{{ shopify_store_country }}_{{ item.id }}_{{ item.variants.first.id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}],
 ecomm_pagetype: 'category',
 ecomm_category: '{{ collection.handle }}'
 };
 {% elsif template contains 'index' %}
 var google_tag_params = {
 ecomm_pagetype: 'home'
 };
 {% elsif template contains 'product' %}
 var google_tag_params = {
 ecomm_prodid: 'shopify_{{ shopify_store_country }}_{{ product.id }}_{{ product.selected_or_first_available_variant.id }}',
 ecomm_pagetype: 'product',
 ecomm_totalvalue: {{ product.selected_or_first_available_variant.price | money_without_currency | remove: ',' }}
 };
 {% elsif template contains 'search' %}
 var google_tag_params = {
 ecomm_prodid: [{% for item in search.results limit:5 %}'shopify_{{ shopify_store_country }}_{{ item.id }}_{{ item.variants.first.id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}],
 ecomm_pagetype: 'searchresults'
 };
 {% else %}
 var google_tag_params = {
 ecomm_pagetype: 'other'
 };
 {% endif %}
 /* <![CDATA[ */
 var google_conversion_id = {{ google_conversion_id }};
 var google_custom_params = window.google_tag_params;
 var google_remarketing_only = true;
 /* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/{{ google_conversion_id }}/?value=0&amp;guid=ON&amp;script=0"/></div>
</noscript>

 


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

  • Open Theme.liquid file and the code below:
<!-- 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 system has insights about your sales.

Head to Settings > Checkout > Additional Scripts and add the following script (Do not forget to change the AdWords Conversion ID, Country Code and Currency Code):


<!-- Google Dynamic Remarketing -->
{% comment %} Enter your account specific value below {% endcomment %}
{% assign google_conversion_id = 0 %}
{% assign shopify_store_country = 'US' %}
{% if shop.currency == 'CAD' %}
{% assign shopify_store_country = 'CA' %}
{% endif %}
<script type="text/javascript">
var google_tag_params = {
 ecomm_prodid: [{% for item in order.line_items %}'shopify_{{ shopify_store_country }}_{{ item.product.id }}_{{ item.variant.id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}],
 ecomm_pagetype: 'purchase',
 ecomm_totalvalue: {{ total_price | money_without_currency | remove: ',' }}
};
</script>
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = {{ google_conversion_id }};
var google_custom_params = window.google_tag_params;
var google_remarketing_only = true;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/{{ google_conversion_id }}/?guid=ON&amp;script=0"/></div>
</noscript>

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. 🙂

Need help with AdWords? Or any other form of online marketing?

Connect with me. Let's talk business. Fill in the query form here, call me at +91 99719 19509 or DM me on @ratanjha.

Leave a Reply

  • (will not be published)