SEO, AdWords, affiliates, advertising, and promotions
<!-- Global site tag (gtag.js) - Google Ads: XXX --> <script async src="https://www.googletagmanager.com/gtag/js?id=AW-XXX"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'AW-XXX'); </script>
{% if first_time_accessed %} <script> gtag('event', 'conversion', { 'send_to': 'AW-XXX/XXX', 'value': {{ checkout.total_price | money_without_currency | replace: ',', '.' }}, 'currency': '{{ shop.currency }}', 'transaction_id': '{{ order.order_number }}' }); </script> {% endif %}I'm using EUR, I read somewhere that I need the replace part.
Solved! Go to the solution
This is an accepted solution.
In that case you first need to remove the dot, then replace the comma separator with a dot.
{{ total_price | money_without_currency | remove:'.' | replace: ',', '.' }}
Otherwise, your prices will be 1.04000, which would be a cheap product 😄
Test out the results, I have not tested it, but it should be correct now.
So the reason you have issues is that anything integer ie a number, needs to be with a dot, and can not consist of commas.
Let me know if you get the correct results now
Hope this helps.
Follow the Shopify instructions and make sure you add the code at the checkout which their instructions miss. If you do this and setup dynamic conversion values. You should see your revenue and sales in Google ads. If you have enhaned ecom turned on in Google Analytics...they you will see your revenue and sales in GA.
The checkout needs both the global site tag and the conversion tag. Otherwise it will not work.
The conversion value should be if prices are 1,000.00
{{ total_price | money_without_currency | remove:',' }}
Or if your prices are 1000,00
{{ total.price | money_without_currency | replace: ',', '.' }}
€1.040,00 is what my prices look like.
I am using the correct code then right?
This is an accepted solution.
In that case you first need to remove the dot, then replace the comma separator with a dot.
{{ total_price | money_without_currency | remove:'.' | replace: ',', '.' }}
Otherwise, your prices will be 1.04000, which would be a cheap product 😄
Test out the results, I have not tested it, but it should be correct now.
So the reason you have issues is that anything integer ie a number, needs to be with a dot, and can not consist of commas.
Let me know if you get the correct results now
Hope this helps.
'value': {{ total.price | money_without_currency | remove:'.' | replace: ',', '.' }}, 'currency': '{{ shop.currency }}', 'transaction_id': '{{ order.order_number }}'
^ My current code (just the part that matters)
I also included the global tag (so this is in checkout now, and in the template.liquid
1. Do I need to put {{ total.price | money_without_currency | remove:'.' | replace: ',', '.' }}, between ' too? Like '{{ shop.currency }}'
2. Is the code total.price or checkout.total_price? I see different options on different resources.
the placement of the value does not matter, how you have done it is ok.
With regards to the differences, sorry I made a typo, it should be total_price and not total.price
Hope this helps.
Emmanuel has helped a lot and that should work. If it doesn't, look at the source code of a page for an order. You will see what is being outputted which provides a good clue as to what's happening.
Hi Emmanuel,
In this way, the tag is tracking all the EUR value of the store, and if my google ads account is using USD, the order value will be exchanged into USD in google ads account automatically, right?
Yes, that is correct Emma. More info: https://support.google.com/google-ads/answer/3419241
On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023The year-end shopping season is just around the corner. Is a flash sale on your radar? Are...
By Jasonh Nov 6, 2023