Google Shopping Conversion Tracking

Solved
New Member
7 0 0

Hi,

i am having a problem to get the google ads tracking to work. 

 

We are actually not using the google shopping app, because we need a more difficult mapping of fields. So we cannot use the feature of that app to setup the tracking scripts automaticly, wich is recommended in multiple other threads around this topic.

 

I followed the official shopify guides and added the following code snipped to our theme.liquid <head> section:

  <script async src="https://www.googletagmanager.com/gtag/js?id=AW-*******1234*********"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());

    gtag('config', 'AW-*****1234*****');
  </script>

Then in settings > checkout > additional scripts i added: 

{% if first_time_accessed %}
<script>
  gtag('event', 'conversion', {
      'send_to': 'AW-******12234**********',
      'value': {{ checkout.total_price | money_without_currency }},
      'currency': '{{ shop.currency }}',
      'transaction_id': '{{ order_number }}'
  });
</script>
{% endif %}

This is actually not working at all. There has been lots of conversions, but the conversion action within google ads has not been verified. All the setup was made 2 weeks ago, so it's not a delay of google ads.

 

What am i doing wrong?

Im JS developer myself and feel kinda stupid, because after reading the shopify docs several times, i cannot find anything wrong.

 

Regards

Stefan

 

0 Likes
Highlighted

Hi Stefan

 

Why not import a Google Analytics goal based on someone making a purchase into Google ads? If you do that, then you can track everything you want. Just make sure you import the transaction goal type and you are good to go. Hope you found this helpful, if so please click "like" below to let me know.

We help ecommerce brands create, manage and scale profitable PPC campaigns across North America, Europe and Australia. We also help with Conversion Rate Optimization: TakeSomeRisk.com

P.S. Take my Google Shopping Course and help grow your revenue this month.
0 Likes
Highlighted
Shopify Partner
207 4 34

You should install both global tag and event in the additional section.

 

It will then work.

Google Shopping Specialist - Data Feed Managment Tool
0 Likes
Highlighted
New Member
7 0 0

I recognized that too yesterday and added it to the section. Im just wondering why there is no hint about that in the official shopify tutorial. 

 

But there was one more issue, that is probably country specific and even not documented.

In the most european countries the price values are displayed with a comma separator such as 9,99 EUR. So the value returned from 

 {{ checkout.total_price | money_without_currency }},

is not a valid number and caused a script error.

 

I am not sure if google accepts the value as string, but for now i changed it to: 

'value': '{{ checkout.total_price | money_without_currency }}',

 

Those changes has been done about 10h ago and still there is no active tracking status in google ads. 

Any idea what else could be wrong?

 

0 Likes
Highlighted

Success.

Shopify Partner
207 4 34

the correct code is

checkout.total_price | money_without_currency | remove:'.' | replace: ',', '.'
Google Shopping Specialist - Data Feed Managment Tool
1 Like
Highlighted
New Member
7 0 0

Thank you!

I just changed it and wait another few hours to see it in google ads.

0 Likes
Highlighted
New Member
7 0 0

It is finally working! Even when submitting the cart value as string. 

 

Thank you!

 

0 Likes
Highlighted
Shopify Partner
207 4 34

You should submit it as an integer, not a string.

 

So remove the double or single quotes.

 

It should look like this: 

 

{% if first_time_accessed %}
<script>
  gtag('event', 'conversion', {
      'send_to': 'xx-123456789123/lkadsjKDweLK45W',
      'value': {{ checkout.total_price | money_without_currency | remove:'.' | replace: ',', '.' }},
      'currency': '{{ shop.currency }}',
      'transaction_id': '{{ order.order_number }}'
  });
</script>
{% endif %}
Google Shopping Specialist - Data Feed Managment Tool
0 Likes
Highlighted
New Member
7 0 0

Thats exactly how i changed it finally.

 

But earlier conversion values has been sent as string and worked too. It does not really matter if you send the value prop as string or number. Google accepted both and counted them up well.

 

However... thanks again for your help!

 

0 Likes