Categories: Google Adwords Remarketing

How to add Google Adword Dynamic Remarketing code in shopify

Remarketing allows you to show ads to people who have previously visited your website or used your mobile app. Dynamic remarketing takes this a step further, letting you show previous visitors ads based on products or services they viewed on your website.

To add google adwords remarketing in shopify is not a complex thing, just you have to know the variables to fetch variable and where to add remarketing code in shopify ecommerce.

Steps to add Google Adwords Dynamic Remarketing(Retails) code on Shopify:

1.) Login with Admin.

2.) Go to Online Store -> Themes.

3.) Add below code for Home page (index.liquid).

<!-- for home page -->
<script type="text/javascript">
var google_tag_params = {
ecomm_prodid: [],
ecomm_pagetype: 'home',
ecomm_totalvalue: 0
};
</script>

4.) Add below code for Category page (collection.liquid)

<!-- for category page -->
<script type="text/javascript">
var google_tag_params = {
ecomm_prodid: [],
ecomm_pagetype: 'category',
ecomm_totalvalue: 0
};
</script>

5.) Add below code for Product page (product.liquid).

<script type="text/javascript">
var veriantId = jQuery('[name="id"]').val();
/* to get veriant id you might have to modify above line */ 
var google_tag_params = {
ecomm_prodid: 'shopify_GB_{{product.id}}_'+veriantId,
ecomm_pagetype: 'product',
ecomm_totalvalue: {{ product.price_min | money_without_currency | remove: "," }}
};
</script>

6.) Add below code for Cart page (cart.liquid)

<script type="text/javascript">
var price={{ cart.total_price| money_without_currency | remove: "," }};
var productIDs = new Array();
{% for item in cart.items %}
productIDs.push('shopify_GB_{{item.product.id}}_{{item.variant.id}}');
{% endfor %}
var google_tag_params = {
ecomm_prodid: productIDs,
ecomm_pagetype: 'cart',
ecomm_totalvalue: price
};
</script>
Shopify Dynamic Remarketing Cart Page

7.) Add below code in main template file. before closing body tag (theme.liquid).

<script type="text/javascript">
if(typeof(google_tag_params)=='undefined')
{
var google_tag_params = {
ecomm_prodid: [],
ecomm_pagetype: 'other',
ecomm_totalvalue: 0
};
}
</script>
<script type="text/javascript">
/* <![CDATA[ */ 
var google_conversion_id = XXXXXXXXXX; 
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/XXXXXXXXXX/?value=0&guid=ON&script=0"/>
</div>
</noscript>

8.)  Go to  Setting -> Checkout.

9.)  Add the below code in Additional content and script  box inside Order processing, for order confirmation page.

<script type="text/javascript">
var google_tag_params = {
       ecomm_prodid: [{% for line_item in order.line_items %} 'shopify_GB_{{line_item.product.id}}_{{line_item.variant.id}}', {% endfor %}],
       ecomm_pagetype: 'purchase',
       ecomm_totalvalue: {{ subtotal_price | money_without_currency | remove: ","}}
   };
</script>
<script type="text/javascript">
/* <![CDATA[ */
 var google_conversion_id = XXXXXXXXXX;
 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/XXXXXXXXXX/?value=0&guid=ON&script=0"/>
</div>
</noscript>

Note:- Replace XXXXXXXX with conversion id of remarketing code. above code is just for reference, so you can modify as per Shopify version and UI interface of your website. Feel free to get in touch.

Notes On Click

Share
Published by
Notes On Click
Tags: Adword conversion trackingadword remarketingadwords dynamic remarketingShopify

Recent Posts

  • Adword Conversion Tracking
  • Google Adwords Remarketing

Conversion and Remaketing code in BigCommerce

In this blog, you will see how to add Adwords Conversion Tracking and Remarkeing Code in BigCommerce.BigCommerce is one of…

7 years ago
  • Google Analytics and Ecommerce Tracking

Ecommerce Tracking in OpenCart 2.3

Around 6 months back, I had published an article on “How to add GA e-commerce tracking in Opencart“. I am really thankful…

8 years ago
  • Google Analytics and Ecommerce Tracking

Google Analytics Definition and Common Terms

 If you have gone through our previous blog about Google Analytics, you might have sound understanding about Google Analytics and how it…

8 years ago
  • Google Analytics and Ecommerce Tracking

What is Google Analytics and it’s Features?

Do you want to know more about your visitors and how your content is performing?​ Whether you run a website…

8 years ago
  • Google Analytics and Ecommerce Tracking

How to Add Google Analytics in BigCommerce

In this blog, you will see how to add Google Analytics and E-commerce Tracking Code  in BigCommerce. BigCommerce is one of the…

8 years ago
  • Google Analytics and Ecommerce Tracking

Google Analytics and E-commerce Tracking in Miva Merchant

If you have gone through some of previous blog, you might have seen how to install google analytics, e-commerce tracking…

8 years ago