How to add Google Dynamic Remarketing code in Shopify

Product Page:

Paste the below code in the product.liquid template and replace xxxxxxxxx with your google_conversion_id:

<!-- Google Code for Remarketing Tag -->
<!--------------------------------------------------
Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup
--------------------------------------------------->
<script type="text/javascript">
var google_tag_params = {
ecomm_prodid: 'shopify_US_{{ product.id }}_{{ product.variants.first.id }}',
ecomm_pagetype: 'product',
ecomm_totalvalue: {{ product.price | money_without_currency | remove: ',' }},
};
</script>
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = xxxxxxxxx;
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/xxxxxxxxx/?value=0&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

Cart Page:

Paste the below code in the cart.liquid template and replace xxxxxxxxx with your google_conversion_id:

 

<!-- Google Code for Remarketing Tag -->
<!--------------------------------------------------
Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup
--------------------------------------------------->
<script type="text/javascript">
var google_tag_params = {
ecomm_prodid: [{% for item in cart.items %}'shopify_US_{{item.product.id}}_{{ item.product.variants.first.id }}',{% endfor %}],
ecomm_pagetype: 'cart',
ecomm_totalvalue: {{ cart.total_price | money_without_currency | remove: ',' }},
};
</script>
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id =xxxxxxxxx;
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/xxxxxxxxx/?value=0&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

 

Order Confirmation Page

Paste the below code in the order.liquid template and replace xxxxxxxxx with your google_conversion_id:

<!-- Google Code for Remarketing Tag -->
<!--------------------------------------------------
Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup
--------------------------------------------------->
<script type="text/javascript">
var google_tag_params = {
ecomm_prodid: [{% for line_item in order.line_items %}'{{ line_item.sku }}',{% endfor %}],
ecomm_pagetype: 'purchase',
ecomm_totalvalue: {{ order.total_price | money_without_currency | remove: ','}},
};
</script>
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id =xxxxxxxxx;
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/xxxxxxxxx/?value=0&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

Hire us to setup your dynamic remarketing campaign.  Let’s Talk!