SiteKickr Web Development

Shopify Google Dynamic Remarketing Tag with Custom Parameters

The quick and easy approach to setting up custom Google Remarketing parameters in Shopify is to use the following tags (typically in your theme.liquid).

{{ product.id }}
{{ template }}
{{ product.price_min | money_without_currency }}

The issue that you’ll run into though, is that Google complains when the ecomm_totalvalue is wrapped in quotes.

So, we just remove the quotes, right?

Not exactly.  Not every page on your site will be a product page, and hence will not have a price.

On the home page, for example, that would leave us with an invalid object:

ecomm_prodid: ‘ ‘,
ecomm_pagetype: ”,
ecomm_totalvalue: ,

One pretty quick trick that I use is to simply add a zero (0) before the value, as shown below.

<script type="text/javascript">
 var google_tag_params = {
 ecomm_prodid: '{{ product.id }}',
 ecomm_pagetype: '{{ template }}',
 ecomm_totalvalue: 0{{ product.price_min | money_without_currency }},
 };
 </script>

Using this method, the worst that happens is you might get a price that looks like this:

021.99

Which is still a valid numeric value.