A space to discuss online store customization, theme development, and Liquid templating.
Hi, i'm having issues with google analytics/ads not recording conversions properly. It only confirms some sales that's tracked through the thank you page but not all. It doesn't track any other e-commerce conversions such as checkout totals, products sold or anything. It's been installed for at least 6 month. Also, the data is off. For example google analytics says there has been 50 visitors on the website today but shopify says there has been 125. We feel as if our google ads are not working properly due to not having the correct data. They can't optimise themselves for revenue when there's no data.
This is the google analytics code we added to the theme. Is it all correct?
This is the data for E-commerce purchases from the start of january til now and as you can see there is no data.
Any advice on what to do would be massively appreciated as we are at a loss as to what to do.
Solved! Go to the solution
This is an accepted solution.
The third script snippet has two bits that has the text "G-EXAMPLE" . That has to be replaced with the actual Google Analytics 4 measurement ID from your data stream.
You are using Google Analytics 4 - that is the latest Google Analytics version.
Have you also added tracking code to the order confirmation page?
Go to theme ‘Settings’ >> ‘Checkout’, add another piece of tracking code to the ‘Additional Scripts’ section under ‘Order Status Page’. That's likely near the bottom of the page.
That's the code below. Replace the XXXXXXXX with your measurement ID from your GA4 data stream
.
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=XXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'XXXXXXXX');
{% if first_time_accessed %}
gtag("event", "purchase", {
transaction_id: "{{ order.order_number }}",
value: {{ total_price | times: 0.01 }},
tax: {{ tax_price | times: 0.01 }},
shipping: {{ shipping_price | times: 0.01 }},
currency: "{{ order.currency }}",
items: [
{% for line_item in line_items %}
{
item_id: "{{ line_item.product_id }}",
item_name: "{{ line_item.title | remove: "'" | remove: '"' }}",
currency: "{{ order.currency }}",
price: {{ line_item.original_price | times: 0.01 }},
quantity: {{ line_item.quantity }}
},
{% endfor %}
]
});
{% endif %}
</script>
Thank you very much for your quick reply, i believe we already have that code in, with a few extras at the top. Does everything look correct?
This is an accepted solution.
The third script snippet has two bits that has the text "G-EXAMPLE" . That has to be replaced with the actual Google Analytics 4 measurement ID from your data stream.
Ah i can't believe we missed that, thank you very much for your help.
Sorry to bother you again. We've had a problem where google analytics is not counting conversions and conversions values properly (A few here and there). When i import the conversions from analytics into ads, the ads are not showing any conversion values such as revenue. Any help would be massively appreciated. Thank you
A couple of questions:
1. When you say Google Analytics is not counting conversions and the values properly, could you give more details? Do you mean there are less conversions and revenue seen in Google Analytics than the actual sales figures? Or?
2. How did you import your conversions and conversion values into Google Ads? Are your Google Ads and Google Analytics linked?
3. When you import the conversions from G. analytics into G. ads, which attribute in Google Ads are you using to view the revenue?
1. So Google analytics is showing a higher number of Users and Revenue than shopify analytics so we think it is misreading the data and showing more than there actually is (as shown in the pictures below)
2.As far as I'm aware the google analytics and google ads accounts are linked, the default Purchase Conversion wasn't tracking conversion value so i tried importing a purchase conversion from google analytics instead since Google analytics was at least tracking conversions and revenue, but while google ads seem to be tracking if a user purchases and completes a checkout, its still not tracking the value of the checkout, in the picture below it shows there's been 1 conversion from one of the ads so shouldn't there also be a value in the "con. value" category?
3. we are using the "Conversion. value / All" attribute i think
All the screenshots below are from last week