Adding Google Remarketing Tag To Shopify
Original article: https://feedarmy.com/kb/adding-google-adwords-remarketing-tag-to-shopify/
theme.liquid
open theme.liquid and before the closing tag, paste the remarketing code. It should look something like the following code:
Important Update liquid variables
It's important to make sure the Product ID, page type and total value are replaced with dynamic data.
These are the important variable to make sure are updated:
ecomm_prodid: '{{ product.id }}'
ecommtotalvalue: {{ product.pricemin | moneywithoutcurrency }}
ecomm_pagetype: '{% if template contains 'collection' %}category{% elsif template contains 'index' %}home{% elsif template contains 'search' %}searchresults{% else %}{{ template }}{% endif %}'
Code Example
{% if template contains "product" or template contains 'collection' or template contains 'index' or template contains 'search' %}
<!-- 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 = {
{% if template contains 'product' %}ecomm_prodid: '{{ product.id }}',{% endif %}
ecomm_pagetype: '{% if template contains 'collection' %}category{% elsif template contains 'index' %}home{% elsif template contains 'search' %}searchresults{% else %}{{ template }}{% endif %}',
{% if template contains 'product' %}ecomm_totalvalue: {{ product.price_min | money_without_currency }},{% endif %}
};
</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={{ product.price_min | money_without_currency }}&guid=ON&script=0"/>
</div>
</noscript>
{% endif %}