Google Shopping Conversion Tracking

Solved
Stefan78
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

 

Accepted Solution (1)

Accepted Solutions
EmmanuelFlossie
Shopify Partner
1546 91 370

This is an accepted solution.

the correct code is

checkout.total_price | money_without_currency | remove:'.' | replace: ',', '.'
I'm a Google Shopping Specialist and a Google Product Expert Education Award winner, a Google Ads Diamond Product Expert, and also a Google Partner.
Need Data Feed or Google Shopping support? Get in touch.

View solution in original post

Replies 11 (11)
DuaneBrown
Shopify Expert
1568 152 932

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 & DTC brands create, manage and scale profitable PPC campaigns: TakeSomeRisk.com

P.S. Take my Google Shopping Course and help grow your revenue this month.
EmmanuelFlossie
Shopify Partner
1546 91 370

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

 

It will then work.

I'm a Google Shopping Specialist and a Google Product Expert Education Award winner, a Google Ads Diamond Product Expert, and also a Google Partner.
Need Data Feed or Google Shopping support? Get in touch.
Stefan78
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?

 

EmmanuelFlossie
Shopify Partner
1546 91 370

This is an accepted solution.

the correct code is

checkout.total_price | money_without_currency | remove:'.' | replace: ',', '.'
I'm a Google Shopping Specialist and a Google Product Expert Education Award winner, a Google Ads Diamond Product Expert, and also a Google Partner.
Need Data Feed or Google Shopping support? Get in touch.
Stefan78
New Member
7 0 0

Thank you!

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

Stefan78
New Member
7 0 0

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

 

Thank you!

 

EmmanuelFlossie
Shopify Partner
1546 91 370

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 %}
I'm a Google Shopping Specialist and a Google Product Expert Education Award winner, a Google Ads Diamond Product Expert, and also a Google Partner.
Need Data Feed or Google Shopping support? Get in touch.
Stefan78
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!

 

minorfiguresdev
New Member
2 0 0

I know this is going way back, but I've followed this same tutorial and Conversion Tracking is not working.  In the additional scripts section I need to add what global tag and event? 

EmmanuelFlossie
Shopify Partner
1546 91 370

There is no reference to a tutorial in this thread, so not sure which one you are referring to. However I have written a great article you can follow here: https://feedarmy.com/kb/adding-adwords-conversion-tracking-to-shopify/

I'm a Google Shopping Specialist and a Google Product Expert Education Award winner, a Google Ads Diamond Product Expert, and also a Google Partner.
Need Data Feed or Google Shopping support? Get in touch.
minorfiguresdev
New Member
2 0 0

Thank you for the response.  I didn't realize that the Global Site Tag script was required there too, I assumed it would be on the Checkout pages because I added it in the Google Analytics section of Shopify.  I'm hoping that will fix it, thank you.