GA4 Ecommerce Tracking — How to Track Purchases and Transactions Without Errors
> cd .. / HUB_EDITORIALE
Seo e analitica

GA4 Ecommerce Tracking — How to Track Purchases and Transactions Without Errors

[2026-07-15] Author: Ing. Calogero Bono
> share
Zenithby Meteora Web The operating system for your business. Social, clients, bookings and invoices in one platform. Gyms, barbers, professionals. Discover Zenith Free demo · no card

You run an e-commerce store, look at GA4 reports, and the numbers don't match your actual sales. It happens more often than you think. We see it every time we take over an existing project: duplicate events, purchases with no value, lost sessions. The problem isn't GA4. It's how you configured it.

Why is e-commerce tracking in GA4 different from Universal Analytics?

Universal Analytics was session-based and hit-based. GA4 is event-based and parameter-based. In UA, enhanced e-commerce was a plugin: you sent a dataLayer.push array with the ecommerce object and GA handled it. In GA4 there is no predefined ecommerce object. Every interaction is an event with specific parameters: purchase, add_to_cart, view_item, etc.

This change has two concrete consequences:

  • You must map events yourself in Google Tag Manager or via gtag. No more ready-made object magic.
  • Parameters must be normalized — GA4 only accepts specific names for item_id, item_name, price, quantity. If you use custom keys, data won't populate.

At Meteora Web, we managed the ERP system of a clothing store from the inside — margins, inventory, seasons. That's why we know that if purchase data doesn't reach GA4 cleanly, later analyses (ROAS, LTV, product performance) are worthless.

Sponsored Protocol

Which events are essential for enhanced e-commerce in GA4?

GA4 defines a set of recommended events for e-commerce. They're not mandatory, but if you don't use them, you lose most predefined reports (like purchase funnel, product view, item performance).

The main events are:

  • view_item — when a user views the product page.
  • add_to_cart — when they add to cart.
  • remove_from_cart — when they remove.
  • begin_checkout — checkout start.
  • add_shipping_info — if you have shipping steps.
  • add_payment_info — if you have payment steps.
  • purchase — completed purchase.

For each event you must send an items array with at least: item_id, item_name, price, quantity. Other fields like item_category, item_brand, discount are optional but enrich reports.

Sponsored Protocol

How to implement the purchase event with Google Tag Manager?

Most errors happen here. Let's see the clean method: push the dataLayer on the order confirmation page.

Suppose your backend (PHP, Laravel, Node, etc.) outputs JavaScript with the order data just processed. Here's the dataLayer.push for purchase:

dataLayer.push({
  event: 'purchase',
  ecommerce: {
    transaction_id: 'ORD-2026-12345',
    value: 149.99,
    currency: 'EUR',
    items: [
      {
        item_id: 'SKU-1234',
        item_name: 'Merino wool sweater',
        item_category: 'Clothing/Sweaters',
        price: 79.99,
        quantity: 2
      },
      {
        item_id: 'SKU-5678',
        item_name: 'Wool beanie',
        item_category: 'Accessories/Hats',
        price: 29.99,
        quantity: 1
      }
    ]
  }
});

Field naming: GA4 requires transaction_id (unique string), value (number — order total), currency (ISO 4217, e.g. 'EUR'). items is an array of objects. Even if you have a single product, always use an array.

Sponsored Protocol

Then in GTM create a Google Analytics 4 – GA4 Event tag, fired by a custom trigger listening for the 'purchase' event. In the tag, set event name to purchase and read parameters from the same dataLayer.

How to prevent duplicate purchase event?

Common mistake: user reloads the confirmation page and the event fires again. Solutions:

  • Set a session variable or database flag marking the order as already tracked. If present, don't output the dataLayer.
  • Use a temporary cookie in the browser to block subsequent pushes on page reload.
  • In GTM, check “Fire once per page” on the trigger. Not enough if page is cached? Better a server-side flag.

How to verify that tracking works with DebugView and BigQuery?

Don't trust standard reports immediately after implementation. Use DebugView in GA4: enable preview mode from GTM, do a test purchase, and check that the purchase event appears with all parameters. Verify: is transaction_id present? Is value numeric? Is items a non-empty array?

Sponsored Protocol

If you have BigQuery linked to GA4 (advanced but powerful), run a direct query:

SELECT
  event_name,
  event_params.value.string_value AS transaction_id,
  event_params.value.double_value AS revenue
FROM `your-project.analytics_123456789.events_*`
CROSS JOIN UNNEST(event_params) AS event_params
WHERE event_name = 'purchase'
  AND event_params.key = 'transaction_id'
LIMIT 10;

If the result is empty or parameters are null, there's an implementation issue.

At Meteora Web, we had an e-commerce client with images in several MB: by optimizing them we reduced weight by 60% without quality loss. The site flew. But the real problem was their purchase tracking: they sent value as a string and GA4 ignored it. DebugView fixed it in 10 minutes.

What to do now

You don't need to be an analytics expert to get tracking right. Follow these steps:

Sponsored Protocol

  1. Check your order confirmation page — does the backend output a dataLayer with purchase and correct parameters? If not, ask your developer to add it.
  2. Set up a GA4 event tag in GTM for the purchase event. Use a Custom Event trigger named 'purchase'.
  3. Test with DebugView by doing a real purchase (use a 100% discount coupon to avoid spending).
  4. Prevent double firing server-side: once the order is tracked, don't re-insert the dataLayer.
  5. For maximum reliability, enable BigQuery export and verify with SQL. It costs a few euros a month and gives you full control.

A site is measured in revenue, not compliments. If your GA4 doesn't know how much you sell, you don't know if you're making or losing money. Start from here.

For the complete GA4 ecosystem, read our pillar guide: Google Analytics 4 Complete — from setup to advanced reports.

Also see: Embeddings for Semantic Search — if you want to enrich your e-commerce data with meaning-based search.

> share
Ing. Calogero Bono

> AUTHOR_EXTRACTED

Ing. Calogero Bono

Ingegnere informatico, fondatore di Meteora Web e Zenith OS. System administrator e progettista di piattaforme, app e CMS proprietari, con esperienza in sviluppo full-stack, marketing digitale ed ecosistema Google.
[ Read Full Dossier ]

> METEORA_WEB // DIGITAL AGENCY

We build the digital presence your business deserves.

Websites, social media, online advertising, e-commerce and high-performance hosting, engineered with method by computer engineers in Sciacca, for all of Italy.

> MW_JOURNAL

> READ_ALL()