Google dynamic remarketing tag code

Teslyar
Tourist
8 0 1

Hi,

 

Does anyone have the hardcoded Google dynamic remarketing code for Shopify that they can share with me for theme.liquid and checkout?

 

I haven't seen any templates around apart from some using the old event snippets.

 

It would be super helpful for others in the same position too.

 

Thank you.

0 Likes

@Teslyar, have you seen the dynamic remarketing code in my Google Shopping book? Most code people give out is just the dang same one Google suggests, which is of little help for Shopify.

Run Google Shopping ads? Get the free definitive guide to Google Shopping for Shopify (no optin required): https://www.digitaldarts.com.au/google-shopping
0 Likes
Teslyar
Tourist
8 0 1

Thanks. I've added the code, changed what needs to be changed and linked the attributes via google analytics to google ads. 

 

Let's see what hits we get after 24 hours when it updates.

0 Likes
Teslyar
Tourist
8 0 1

@Josh_Uebergang Your code appears to be missing the 'home' pagetype. Do you have additional script for this?

 

Kind regards,

 

Yuriy

0 Likes

I believe the homepage offers no value in dynamic remarketing. Everyone visits the homepage which means the products they get displayed there are not personalized so what's the point of trying to target people with them? If you want to retarget home page visitors, you can build your own audience in analytics of people who visit the home page.

Run Google Shopping ads? Get the free definitive guide to Google Shopping for Shopify (no optin required): https://www.digitaldarts.com.au/google-shopping
0 Likes
RaulD
Tourist
5 0 0

Hi @Josh_Uebergang ,

 

Could you please let me know if the following code and the way of inserting it, is ok for the dynamic remarketing?

I have added all three custom dimensions ecomm_prodid, ecomm_pagetype and ecomm
_total value in Universal GA, then I added also the dynamic atribute for retail.

Screenshot 2021-06-12 at 11-53-17 Analytics.png

  

Once added it requires inserting the following JS snippet:

var dimensionValue = 'SOME_DIMENSION_VALUE';
ga('set', 'dimension1', dimensionValue);

 

So what I would like to do, is to add into Shopify/Preferences/Google Analytics/Additional Google Analytics JavaScript section the following code:

var ecomm_prodid = 'shopify_RO_{{ product.id }}_{% if product.variants.first.id %}{{ product.variants.first.id }}',{% else %}{{ product.variants.id }}',{% endif %}';
ga('set', 'dimension1', ecomm_prodid);
var ecomm_pagetype = '{{ template }}';
ga('set', 'dimension2', ecomm_pagetype);
var ecomm_totalvalue = '{{ total_price | money_without_currency | replace: ",", "." }}';
ga('set', 'dimension3', ecomm_totalvalue);

 

Thank you

0 Likes
RaulD
Tourist
5 0 0

Hi @Josh_Uebergang,

 

I have seen and implemented your guide  on dynamic remarketing. Thanks so much for sharing such valuable info.

One question:

On pre-requisites setup, at second point, you mentioned to add Google Analytics from this tutorial https://www.digitaldarts.com.au/google-ads-conversion-tracking-shopify.

So on checkout / order processing /additional scripts I will need to add also the script from GA setup on top of the Remarketing code for checkout?

In such case would it be ok to use the following code?

many thanks in advance for your help

<!-- START Google Ads dynamic remarketing by DigitalDarts.com.au v1.5 -->
{% assign UA-ID = "UA-PROPERTY_ID" -%}
{%- assign AW-ID = "AW-GOOGLE_CONVERSION_ID" -%}
{%- assign product-id = "product-id_variant-id" -%}
{%- assign product-id-prefix = "shopify_EU_" -%}
{%- assign price-decimal-fs = false -%}

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ UA-ID }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ UA-ID }}', { 'send_page_view': false, 'custom_map': {'dimension1': 'ecomm_prodid', 'dimension2': 'ecomm_pagetype', 'dimension3': 'ecomm_totalvalue'} });
gtag('config', '{{ AW-ID }}');
</script>

<!-- START Event snippet for Sales conversion page -->
{% if first_time_accessed %}
<script>
gtag('event', 'conversion', {
'send_to': 'AW-GOOGLE_CONVERSION_ID',
'value': {{ checkout.total_price | money_without_currency}},
'currency': '{{ order.currency }}',
'transaction_id': '{{ order.order_number }}'
});
</script>
{% endif %}
<!-- END Event snippet for Sales conversion page -->

<script>
gtag('event', 'Dynamic Remarketing', { 'ecomm_pagetype': 'purchase'
{%- if product-id == "product-id_variant-id" -%}
, 'ecomm_prodid': [{% for item in checkout.line_items limit:3 %}'{{ product-id-prefix }}{{ item.product_id }}_{{ item.variant_id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
{%- elsif product-id == 'variant-id' -%}
, 'ecomm_prodid': [{% for item in checkout.line_items %}'{{ product-id-prefix }}{{ item.variant_id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
{%- elsif product-id == 'sku' -%}
, 'ecomm_prodid': [{% for item in checkout.line_items %}'{{ product-id-prefix }}{{ item.sku }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
{%- endif -%}
, 'ecomm_totalvalue': {% if price-decimal-fs == true -%}{{ checkout.total_price | money_without_currency | remove: ',' }}{% else %}{{ checkout.total_price | money_without_currency | remove: '.' | replace: ',', '.' }}{%- endif -%}
, 'non_interaction': true });
</script>
<!-- END Google Ads dynamic remarketing by DigitalDarts.com.au v1.5 -->

0 Likes