Greetings,
I am currently attempting to track revenue and purchases in Google Analytics 4. To achieve this, I found a data layer script online and have successfully utilized it to pass events for product views, adding to cart, removing from cart, etc. However, I am encountering difficulties in passing data for checkout and purchases.
I would greatly appreciate your assistance in identifying a solution for accurately tracking this critical data in Google Analytics for optimization purposes.
The code we have implemented is as follows:
https://github.com/ruturajjadeja/GA4-Shopify-DataLayer/blob/62c1c948651faa379247dac7529f3412376b9189/dataLayer-allPages.js
1 Like
Hey @imabhiraj - you might want to take a look at our web pixel extension functionality. This should allow you to pull customer event data including products views/cart events and some basic checkout events like when a checkout is completed (including a unique checkout token ID you can use for tracking purposes).
After you’ve created the web pixel integration, the emitted data captured by the pixel should be able to be shared with GA4 (most likely using the Google Measurement Protocol API, if you haven’t looked into that!) By capturing event data with our webpixel functions it may help you streamline things by allowing you to easily subscribe to all customer events through a single integration. We’re unable to help with code-level recommendations, but I wanted to share this as a potential workaround for you.
Hope this helps!
Al | Shopify Developer Support
Hi @ShopifyDevSup - can we turn on enhanced conversions for Google Ads using this web pixel? ie; can the enhanced added to the tag somehow?
Thanks,
Brian