GA4 E-commerce Tracking Setup: Events, Data Layer and Google Tag Manager Guide

A complete guide to GA4 e-commerce tracking - which events to send, what the data layer should look like, how to configure Google Tag Manager and how to test everything before you trust the reports.

Google Analytics 4 can show you exactly where shoppers drop off, which products sell and which channels bring revenue, but only if e-commerce tracking is set up correctly. Many stores send only a purchase event, or send events with missing item data, and then wonder why the reports are empty.

This guide explains the GA4 e-commerce events, shows data layer examples and walks through a Google Tag Manager setup.

The GA4 e-commerce events

GA4 uses a fixed set of recommended e-commerce events. Using the exact names and parameters is what fills the built-in reports.

Event When to send
view_item_list A list of products is shown (category, search results)
select_item A product in a list is clicked
view_item A product page is viewed
add_to_wishlist Product added to wishlist
add_to_cart Product added to cart
remove_from_cart Product removed from cart
view_cart Cart page viewed
begin_checkout Checkout started
add_shipping_info Shipping step completed
add_payment_info Payment step completed
purchase Order completed
refund Order (partly) refunded
view_promotion / select_promotion Internal banners viewed/clicked

You do not need all of them on day one. The minimum useful set is view_item, add_to_cart, begin_checkout and purchase.

The items array

Every e-commerce event contains an items array. Consistent item data is what makes product reports work:

items: [{
  item_id: "X200-BLK-42",
  item_name: "Trail Running Shoe X200",
  item_brand: "ExampleBrand",
  item_category: "Shoes",
  item_category2: "Trail Running",
  item_variant: "Black / 42",
  price: 129.95,
  quantity: 1
}]

Use the same item_id (SKU or product ID) everywhere, including your Google Ads and Merchant Center feeds.

Data layer examples

view_item

window.dataLayer = window.dataLayer || [];
dataLayer.push({ ecommerce: null });
dataLayer.push({
  event: "view_item",
  ecommerce: {
    currency: "EUR",
    value: 129.95,
    items: [{ item_id: "X200-BLK-42", item_name: "Trail Running Shoe X200", price: 129.95, quantity: 1 }]
  }
});

The ecommerce: null push clears the previous e-commerce object so data from an earlier event does not leak into the next one.

add_to_cart

dataLayer.push({ ecommerce: null });
dataLayer.push({
  event: "add_to_cart",
  ecommerce: {
    currency: "EUR",
    value: 129.95,
    items: [{ item_id: "X200-BLK-42", item_name: "Trail Running Shoe X200", price: 129.95, quantity: 1 }]
  }
});

purchase

dataLayer.push({ ecommerce: null });
dataLayer.push({
  event: "purchase",
  ecommerce: {
    transaction_id: "100045678",
    currency: "EUR",
    value: 259.90,
    tax: 45.10,
    shipping: 0,
    coupon: "AUTUMN10",
    items: [
      { item_id: "X200-BLK-42", item_name: "Trail Running Shoe X200", price: 129.95, quantity: 2 }
    ]
  }
});

Decide once whether value includes tax and shipping, document it and keep it consistent.

Google Tag Manager setup

1. Google tag

Add a Google tag with your GA4 measurement ID, firing on all pages (respecting consent).

2. Data layer variables

You usually do not need separate variables for every field. GA4 event tags in GTM can read e-commerce data directly with the “Send Ecommerce data” option and the Data Layer source.

3. Custom event triggers

Create a Custom Event trigger. You can use one trigger with a regular expression:

view_item_list|select_item|view_item|add_to_cart|remove_from_cart|view_cart|begin_checkout|add_shipping_info|add_payment_info|purchase

4. GA4 event tag

Create a Google Analytics: GA4 Event tag:

  • Event name: {{Event}} (built-in variable)
  • Enable Send Ecommerce data, source: Data Layer
  • Trigger: the custom event trigger above

5. Publish after testing

Platform implementation

  • WooCommerce: many plugins push GA4 e-commerce events to the data layer. Check that they include all items, variants and the correct currency
  • Shopify: use Shopify’s Google channel or a custom pixel via Customer Events; checkout tracking works differently from the storefront
  • Magento 2: use a GA4/GTM data layer extension or a custom module; Hyvä themes need a Hyvä-compatible implementation

Testing

  1. GTM Preview mode: check that each event fires once with the right data
  2. GA4 DebugView: check events and parameters arrive
  3. Place a test order with each payment method, including redirect methods (PayPal, iDEAL, Klarna)
  4. Compare with your shop after a few days: orders and revenue per day

If purchases go missing, see GA4 missing conversions and server-side tracking.

In the EEA and UK, analytics and ads tags must respect the visitor’s consent choice. Implement Consent Mode v2 correctly; see my Consent Mode v2 guide.

Useful GA4 reports for stores

  • Monetisation → E-commerce purchases: product performance
  • Funnel exploration: view_item → add_to_cart → begin_checkout → purchase, by device
  • Acquisition by revenue: which channels bring sales, not just sessions
  • Item list performance: which categories and lists drive clicks

Common mistakes

  • Different item_id formats between events
  • purchase firing twice on page reload
  • Currency missing, so revenue is not recorded
  • Values sent as strings with commas ("129,95") instead of numbers
  • E-commerce object not cleared between events

Frequently asked questions

Do I need Google Tag Manager for GA4 e-commerce?

Not strictly, but GTM makes it easier to manage tags, consent and changes without code deployments.

Why are my GA4 e-commerce reports empty?

Usually because event names or the items array do not match the GA4 specification, or the currency is missing.

Can I track refunds?

Yes, with the refund event, ideally sent from your backend using the Measurement Protocol.

Want tracking you can trust?

I implement GA4 e-commerce tracking, GTM and Consent Mode for WooCommerce, Shopify and Magento stores. See my technical SEO and measurement service or request a tracking audit.