Install Google Analytics Dynamic Remarketing on Shopify

enes
New Member
3 0 0

Hi everyone

 

Does anyone know how to implement Google Analytics Dynamic remarketing for Shopify. I would like to use GA instead of Google Adwords tags,  because GA seems to have advance features for creating audiances.

Thanks a lot !

0 Likes
Maksim_Komonov
New Member
12 0 0

Hi!

There's an easy way to embed GA script to your store. With Custom JavaScript & jQuery scripts app it's easy. No coding, no searching. Just copy&paste. Simple as that. Moreover you can add several scripts of other integrations and run them simultaneously. Even before /head tag. Contact us for help.

Cheers!

We develop complex ecommerce solutions for e-shops, marketplaces, manufacturers, dealers and retailers.
0 Likes
Vishal3
Excursionist
39 0 8

Google Shopping is dynamite for eCommerce. For many Shopify stores its their top performing traffic source. However if you’re running Shopping and not running dynamic remarketing… you’re missing out!

You spend great deals of money getting customers to your store in the first place, and should they not purchase from your store immediately (maybe they need time to think about the purchase), that’s potentially wasted spend.

But with dynamic remarketing you can show them customised ads as they browse the net, keeping your brand and product at the forefront of their thoughts (unless they’re using ad block!).

METHOD 1:  Setup within Shopify 

Add it to your template.liquid file only:

{% comment %} Instructions on using the code. Firstly, all the code can be pasted into an empty section at the bottom of your template.liquid file. Secondly, in the line below, where it shows google_conversion_id = 0, delete the 0 and add your conversion id (found in AdWords) {% endcomment %}
{% assign google_conversion_id = 0 %}
{% assign shopify_store_country  = 'US' %}
{% if shop.currency == 'CAD' %}
{% assign shopify_store_country  = 'CA' %}
{% elsif shop.currency == 'GBP' %}
{% assign shopify_store_country = 'GB' %}
{% 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>

You’ll notice above that if you’re using the Google Shopping App the ecomm_prodid changes based upon the stores location. If you’re running a store in a geography not mentioned above, you can get the two letter country code from the product id in merchant centre.

For the payment confirmation page URL use

thank_you

google_conversion_id }}/?value=0&amp;guid=ON&amp;script=0"/>

</div>

</noscript>

You’ll notice above that if you’re using the Google Shopping App the ecomm_prodid changes based upon the stores location. If you’re running a store in a geography not mentioned above, you can get the two letter country code from the product id in merchant centre.

For the payment confirmation page URL use

thank_you

METHOD 2:  Setup from Google Analytics

Google Analytics is a different thing, that requires a different setup. If you see something like this, ignore it:

Google Analytics Dynamic Remarketing Error Example

It requires code like the below (amongst other things):

Screen Shot 2015-11-10 at 21.21.26

Google Analytics Dynamic Remarketing is more powerful though.

With AdWords, your targeting is limit to URLs. With Analytics, you can target by anything you can create a segment for, including demographics.

Small to medium size sites don’t really need the functionality… there’s arguably not enough traffic to make it worthwhile.

Get 14 days FREE access of Browser Push Notifications at apps.shopify.com/izooto-web-push
0 Likes
Czarto
Shopify Partner
64 2 18

Here is an updated version of Vishal3's solution using the gtag syntax:

https://business.czarto.com/2017/02/07/shopify-dynamic-remarketing-setup/

 

Best,

 

Alex

Digital Marketing @ Manitobah Mukluks
Shopify Digital Marketing Blog: business.czarto.com
0 Likes