Hello,
I have followed this tutorial to start tracking in GA4. An implementation via GTM.
https://www.e2msolutions.com/blog/set-up-ga4-ecommerce-tracking-shopify/
It all goes well but ‘purchases’ do not show up in GA4.
I have implemented below script in checkout as per tutorial.
All other data is going ok, like pageviews and view_items
What am I doing wrong?
thx
Erwin
Dear Erwin,
Did you manage to solve it?
I have the same problem.
Hey @Erwin-Sunhats , the code looks fine, we need check more in the store code. Do you mind to send us the store address so we will dive deeper. I believe the latest shopify customer events+ serverside tracking will be your final solution, we have just supported it last month.
-
If you want to track your purchase and find out which campaigns drive the conversion. You may try Attribuly, it will bring your data accuracy to a new level.
-
If you want to analyze the purchase in GA4, we have a roadmap to integrate attribuly with GA4 so you may also track in GA4. Let me know if you are interested, so we will offer a long time free trial to you.
Thanks
No so far no solutions found to my question.
Do you have this somewhere before your script?
window.dataLayer = window.dataLayer || [];
Without that you’ll get a JS error and the rest of your script won’t run.
Hey Erwin,
Like others, I’d love to know if you got a solution here 
Thanks
James
Hi,
I did not find a solution to my script. I found a developer who did a whole new tracking set up for GA4. Now it works great with more details like add-to-cart and start checkout.
1 Like
@wrayjames we just set up GA4 ecommerce tracking for a client. Initially implemented the setup from e2msolutions.com but there were several issues. So we came up with our own setup per GA4 documentation. We’re monitoring data to validate the results but once that’s done I will post an update here with what we did. And we’d be happy to help you set things up if needed.
1 Like
Hey man,
Did it solve the tracking issues?
@HappyTail @wrayjames
The GA4 commerce tracking we set up is working. I’ll post details below. Keep in mind that there’s no “standard” setup per se – it just depends on what you want to measure. In this case we’re measuring:
- Products viewed
- Products added to cart
- Completed checkouts
That said, here’s what we did.
# product.liquid
Add the script below to the top of the template. This will add an event to the data layer when a product is viewed, and will include the following product info:
- Title
- ID
- Price
- Brand
- Categories
- Selected variant
# product-form.liquid
Add the script below to the bottom of the template. Make sure that the querySelector method targets your add-to-cart button. This will add an event to the data layer when a product is added to the cart, and will include the following product info:
- Price
- Title
- ID
- Brand
- Variant
Confirmation page
Go to Settings > Checkout and add the script below in the Additional scripts box. This will add an event to the data layer when a purchase is completed and will include the following transaction info:
- Currency
- Value
- Tax
- Shipping cost
- Transaction ID
- Items purchased (title, ID, price, brand, quantity, variant)
Additional setup and notes
The scripts above will simply push the data you need into the data layer. In order to actually send the data to GA you’ll need to do a few additional things:
- Make sure the base GA4 script is on every page where you want to use GA.
- Send data from the data layer to GA. This can be done in GTM as outlined in the e2msolutions blog post. Skip to “Create GTM Trigger for the view_item and purchase event”.
Also note that we didn’t do any of the user tracking stuff. And we already had page view tracking set up so the instructions above don’t cover that.
Hope that helps! If anyone needs further assistance feel free to DM me.
1 Like
Wow brother. Thanks a lot!
1 Like