Ecommerce events and the items array

Google Analytics · Practical · 12 min

Revenue, product performance and purchase funnels all depend on these exact event and parameter names.

GA4 has a defined set of ecommerce events and only populates the Monetization reports when you use them with the right parameters. The main sequence:

  • view_item_list and select_item (listing pages),
  • view_item (product page), add_to_cart, remove_from_cart, view_cart,
  • begin_checkout, add_shipping_info, add_payment_info,
  • purchase, and refund for returns,
  • plus view_promotion, select_promotion, add_to_wishlist.

Every one of them carries an items array: one object per product with item_id, item_name (one of the two is required), and optional price, quantity, item_brand, item_category (up to item_category5), item_variant, item_list_name, coupon, discount, affiliation, index, location_id. Up to 27 items are kept per event; you can add custom fields and register them as item-scoped custom dimensions.

Event-level parameters on purchase: transaction_id (required; GA4 deduplicates purchases with the same ID within the property), value (total revenue), currency (ISO 4217 code, required whenever value is sent), optional tax, shipping, coupon. Revenue metrics in reports come from value; item revenue comes from price * quantity per item. Keep them consistent or the two revenue figures will disagree.

Common mistakes: sending value without currency (revenue is dropped), formatting price as a string with a currency symbol, firing purchase on the order confirmation page without protecting against refreshes (use transaction_id and a server-side flag), and sending purchase from both the website and a server-side integration.

If you use GTM, push the same structure into dataLayer with an ecommerce object; GTM's GA4 event tag reads it. Push { ecommerce: null } first so the previous event's items do not leak into the next one.

Example

// Product page
gtag('event', 'view_item', {
  currency: 'EUR', value: 49.0,
  items: [{ item_id: 'SKU_123', item_name: 'Trail Shoe', item_brand: 'Acme',
            item_category: 'Shoes', item_variant: 'blue', price: 49.0, quantity: 1 }]
});

// Add to cart (quantity 2 -> value 98)
gtag('event', 'add_to_cart', {
  currency: 'EUR', value: 98.0,
  items: [{ item_id: 'SKU_123', item_name: 'Trail Shoe', price: 49.0, quantity: 2 }]
});

// Order confirmation page, guarded against reload on the server side
gtag('event', 'purchase', {
  transaction_id: 'T-20260914-0042',  // required: dedupes repeats
  value: 103.0,                        // items 98 + shipping 5
  currency: 'EUR',                     // required with value
  shipping: 5.0, tax: 0.0, coupon: 'SPRING10',
  items: [{ item_id: 'SKU_123', item_name: 'Trail Shoe', price: 49.0, quantity: 2,
            item_category: 'Shoes', item_variant: 'blue' }]
});

Remember

  • Use the documented event names and the items array exactly
  • purchase needs transaction_id, value and currency
  • Prices are numbers; currency is an ISO code; dedupe with transaction_id

Check yourself

  1. You send purchase with value: 59.9 but no currency. What does GA4 do with the revenue?
  2. Which parameter stops a refreshed confirmation page from counting a second purchase?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: developers.google.com/analytics/devguides/collection/ga4/ecommerce