DEV Community

TrackStack
TrackStack

Posted on • Originally published at trackstack.tech

GA4 Ecommerce Events: What Most Stores Get Wrong

Your GA4 shows traffic but zero revenue? You're not alone — over 70% of online stores have broken ecommerce event tracking. The purchase event fires twice on page refresh, the items[] array is empty, or currency says "USD" while prices are in euros.

GA4 uses 10 standardized ecommerce events. Get the names wrong, and data silently disappears from Monetization reports. Here's the minimum you need working on day one:

Event When It Fires
view_item Product page opens
add_to_cart Item added to cart
begin_checkout Checkout initiated
purchase Payment confirmed

The #1 Mistake: Missing ecommerce: null

Before every dataLayer.push, you must clear the previous ecommerce object. Without this, the next event inherits stale items[] from the last push — your purchase event ends up containing products the customer only browsed, not bought.

// Always clear first
dataLayer.push({ ecommerce: null });
dataLayer.push({
  event: "purchase",
  ecommerce: {
    transaction_id: "ORD-2026-78432",
    value: 699.98,
    currency: "USD",
    items: [{
      item_id: "SKU-12345",
      item_name: "Sony WH-1000XM5",
      price: 349.99,
      quantity: 2
    }]
  }
});
Enter fullscreen mode Exit fullscreen mode

Quick Validation Checklist

Before you call it done, verify these:

  • ✅ GTM Preview shows all 4 core events during a test order
  • ✅ Each event has a non-empty items[] with item_id, price, quantity
  • purchase has a unique transaction_id (prevents duplicates on page refresh)
  • currency matches the actual price currency
  • ✅ GA4 DebugView shows events in real time
  • ✅ Revenue in GA4 matches your store backend (±5% is acceptable)

What About Ad Blockers?

Client-side GA4 tracking gets blocked in 15–30% of users. The fix: server-side tracking via Measurement Protocol. Events go from your server directly to GA4, bypassing browser blockers entirely.


📖 The full guide covers: complete dataLayer examples for all 10 events, step-by-step GTM setup with one tag for all events, WooCommerce and Shopify implementation specifics, and 5 common mistakes with fixes.

Read the full article on trackstack.tech →

Top comments (0)