Overview
Google Analytics 4 (GA4) is the future of web analytics, but many merchants struggle to get reliable e‑commerce data out of it. The issue isn’t GA4 itself—it’s the way your site sends data. Platforms like Shopify offer built‑in integrations, but those often miss key events or fire duplicate tags. To get actionable data, you need to take control of your tracking setup. Below we walk through a clear process to set up ecommerce tracking using Google Tag Manager (GTM) on Shopify or WooCommerce, verify that data is flowing to GA4, and maintain good hygiene so your data stays clean. This is battle‑tested advice based on the same setups we use for Lepton clients.
Why use Tag Manager?
Shopify’s custom pixel framework lets you deploy tracking scripts that run at checkout without editing theme files. The advantage is that custom pixels are more secure and easier to manage across events than legacy script tags. Combined with Google Tag Manager, custom pixels give you complete control over what events are fired and when.
GTM also simplifies managing multiple tags (GA4, Facebook, TikTok, etc.) from a single interface.
Step 1 – Create a GA4 property and connect it to GTM
- Create or identify your GA4 property in Google Analytics and copy the Measurement ID (format G‑XXXXXXXXX).
- Add Google Tag Manager to your site: In Shopify, create a custom pixel and paste the GTM container code into it. In WooCommerce, paste the GTM snippets into your
header.php
file or use a plugin. - In GTM, create a GA4 Configuration tag with your Measurement ID and set it to fire on All pages.
- Publish the GTM container.
Step 2 – Implement ecommerce event tracking
Out of the box, Shopify’s Google sales channel can miss critical events like add_to_cart
and view_item
. A Google Analytics expert in Shopify’s community recommends using GTM to integrate GA4 because it gives you control over sending each event to Analytics. We recommend:
- Enable enhanced measurement in GA4, but don’t rely on it alone—it won’t send commerce data.
- Create GA4 event tags in GTM for every key action:
view_item
,add_to_cart
,begin_checkout
,purchase
, and any custom events (e.g.,select_variant
). Use data layer variables or CSS triggers to capture product ID, price and currency. - Use Shopify’s cart and checkout events in the custom pixel to push data into GTM’s data layer. This ensures events fire only once and with the correct values.
Step 3 – Verify your setup
After publishing your GTM container, it’s critical to verify that the data actually reaches GA4. Analytics experts recommend checking Real‑time reports: open your GA4 property, go to Admin → Data Streams → Web, ensure your stream is active, then visit your store and watch for events appearing in the real‑time dashboard. You can also use GTM’s Preview mode to test tags before publishing; the preview tool shows which tags fire and with what parameters. If events are missing or double‑firing, adjust your triggers until the preview shows correct behaviour.
Step 4 – Maintain conversion hygiene
GA4 will only be as accurate as your implementation, so make it part of your routine to audit tracking:
- Check each key event after theme updates or app installations.
- Make sure
add_to_cart
doesn’t fire on page load (common bug). - Confirm that
purchase
fires once and includes order value and transaction ID. - Remove duplicate GA tags to avoid skewed data.

What’s next
Once your ecommerce tracking is solid, you can start using GA4’s audiences and exploration reports to segment high‑value customers, build remarke/ting lists for Performance Max and Meta campaigns, and export data to BigQuery for deeper analysis. In tomorrow’s post we’ll triage your Performance Max campaigns—but for now, pat yourself on the back: you’ve built a clean analytics foundation.
Digital Spaces – AI Driven Research for a look at the future of audience insight

Need help implementing GA4? Contact our team at us for a free website data chat today.