Ecommerce Data Layer Validator

Check ecommerce event items, values and transaction fields.

What Is an Ecommerce Data Layer Validator?

An Ecommerce Data Layer Validator helps review the information a website prepares for ecommerce tracking in Google Tag Manager and Google Analytics 4. Data layer events can describe product views, cart additions, checkout activity, and purchases through fields such as items, value, and transaction_id. Checking their structure can expose missing product details, inconsistent values, or incorrect event names before those issues affect reporting. A valid data object alone does not confirm that Analytics received the event.

Ecommerce Data Layer Validator

Check ecommerce event items, values and transaction fields.

Ecommerce Data Layer Validator thumbnail

Inspect ecommerce event data

To capture the current browser data layer, use JSON.stringify(window.dataLayer) on your own site, redact personal data and paste the output. JavaScript object literals and dataLayer.push(...) code are not executed. Checks item arrays, currencies, prices, values, and transaction IDs; they cannot confirm analytics delivery.

Rate this tool 4.0 out of 5 from 1 rating

Check GA4 Ecommerce Tracking Data from Product View to Purchase

A store can show plenty of website visitors in Google Analytics 4 while its ecommerce reports display missing revenue, incomplete product details, or an implausible number of purchases. These problems often start with the information passed from the storefront into the tracking implementation. A cart event might carry the wrong item quantity; a completed order might omit its transaction identifier; or a tag might never receive the data placed in the page.

Use the Ecommerce Data Layer Validator above to examine the input and findings supported by its installed version. This guide explains how Google Tag Manager ecommerce data is structured, what to check in important GA4 events, and how to test the complete journey from a customer action to an analytics report. The live tool’s input formats, validation rules, network access, and export features have not been independently verified.

Read Full GuideShow Less

Understand what a data layer does before validating it

On a website using Google Tag Manager (GTM), window.dataLayer is generally a JavaScript array that stores messages for the tagging system. The website can add an event message using dataLayer.push(). A message can contain an event name, an ecommerce object, and information describing the affected products.

GTM listens for an event, evaluates its triggers, reads mapped variables, and can forward parameters to GA4. The data layer is not confirmation that GA4 received an event. A valid object may still have an incorrect trigger or destination. The related GA4 Event Payload Validator is useful when the question concerns event parameter structure beyond the ecommerce data layer.

Follow the ecommerce events through a realistic shopping journey

Use the GA4 event name that matches the completed action; a cart click is not a purchase.

GA4 event Customer action Information worth checking
view_item Opens a product detail page Correct product identifier, name, and item details
add_to_cart Adds a product to the cart Actual added quantity, price, item array
begin_checkout Starts the checkout process Checkout item list, total item value, currency
add_payment_info Provides payment information Appropriate checkout context and payment type, if available
purchase Completes an order Transaction ID, currency, value, purchased items
refund Refunds all or part of an order Original transaction reference and refunded item details

Trigger purchase on confirmed order completion, not on every thank-you-page refresh.

Read a purchase data layer push without confusing it with JSON

This illustrative example represents a purchase of two units priced at $24 each. The sum of the item prices multiplied by their quantities is $48, excluding separate shipping and tax amounts.

window.dataLayer = window.dataLayer || [];
dataLayer.push({ ecommerce: null });
dataLayer.push({
  event: "purchase",
  ecommerce: {
    transaction_id: "ORDER-2048",
    currency: "USD",
    value: 48.00,
    shipping: 5.00,
    tax: 3.00,
    items: [
      {
        item_id: "TSHIRT-BLUE-M",
        item_name: "Blue Cotton T-Shirt",
        price: 24.00,
        quantity: 2
      }
    ]
  }
});

The first push clears the previous ecommerce object so that details from another interaction are not inadvertently carried into the new event. The second push supplies the purchase. This is JavaScript object syntax, not strict JSON. If a validator accepts only JSON, convert the object to valid JSON before checking.

The ecommerce wrapper is a common GTM data layer pattern. A gtag('event', ...) call or GA4 Measurement Protocol request uses a different representation. Before fixing a reported error, establish which representation the tool expects.

Check item identity, prices, and types

For GA4 ecommerce item entries, Google requires at least one of item_id or item_name; supplying both makes product analysis easier. Each event’s items field should be an array rather than a single object. Google documents support for up to 200 items per event and additional custom item parameters within its published limits.

Inspect price and quantity as numeric values. The string "24.00" is not the same JSON data type as 24.00. Check that item quantities reflect the products actually added, purchased, or refunded. GA4 defaults quantity to 1 when omitted, but an explicit quantity is clearer for multi-unit orders.

Keep item identifiers stable across view_item, add_to_cart, and purchase where the same variant is involved. Stable identifiers make events easier to compare.

Reconcile purchase value, currency, and transaction ID

The recommended value represents the sum of item price × quantity amounts. Do not add separately reported shipping or tax into that item-value calculation. For a purchase containing two shirts at $24 each, value is 48, even if the customer’s payable total includes another $5 shipping and $3 tax.

When value is provided, set the event-level currency to an appropriate three-letter ISO 4217 code such as USD or PKR. Sending a number without reliable currency context can undermine monetary reporting. For a completed purchase, transaction_id identifies the order and helps avoid duplicate purchase measurement. An identifier must belong to the real transaction; do not generate a new one when the confirmation page reloads.

For discounts, bundles, or refunds, compare the payload with the order record. A validator cannot infer every pricing rule.

Use an error matrix to prioritize corrections

Finding Why it matters What to inspect next
Missing items or wrong type Product-level ecommerce information is incomplete Supply the expected array of item objects
No item_id or item_name GA4 cannot reliably identify the item Add at least one identifier per item
Text instead of numeric values Calculations may fail or become inaccurate Review price, quantity, value, tax, and shipping types
Missing purchase transaction ID Order identification and deduplication suffer Use a stable order identifier
Value does not match items Revenue analysis may be misleading Recalculate item totals before tax and shipping
Event exists but GA4 is empty The issue may occur after the data layer Check tag trigger, mapping, consent, and delivery

Warnings guide investigation; they do not establish the root cause.

Verify the live path from dataLayer.push to GA4

  1. Reproduce a controlled action. Use a test product and, for purchase testing, an authorized test checkout.
  2. Inspect the event message. Check the page’s data layer history and the exact ecommerce fields available when the action occurred.
  3. Open GTM Preview. Confirm that the expected custom event appears and that the correct GA4 event tag fires at the appropriate time.
  4. Review variable mapping. Ensure fields such as ecommerce.items, ecommerce.currency, and ecommerce.value reach the GA4 event parameters.
  5. Check data delivery. Inspect the browser’s network activity and use GA4 DebugView or Realtime with the necessary debugging setup.
  6. Compare with order data. Verify transaction IDs, purchased SKUs, item quantities, and revenue totals against the test order.

The Google Analytics Tag Detector can support a preliminary installation review, while the GA4 CSV Report Analyzer is a related option for reviewing exported reports. The installed tools’ exact features still require verification.

Avoid stale ecommerce objects and duplicate purchases

Data layer values can persist while the page remains open. If a new event omits a field, GTM may still find an older ecommerce value in its internal model. Google’s GTM ecommerce examples therefore clear the previous ecommerce object before a new event message. Avoid resetting the entire window.dataLayer array after Tag Manager loads; that can interrupt normal tracking behavior.

Single-page applications and stores with asynchronous checkout steps deserve special attention. Tags may fire before product information is available, or a completed order may be announced by two independent integrations. Reproduce the event sequence, inspect each source, and ensure one purchase is represented by a stable transaction ID. Do not assume that valid markup automatically prevents double counting.

Protect customer information during validation

Production ecommerce objects may include internal customer details or order references. Use sanitized examples rather than pasting email addresses, telephone numbers, addresses, payment details, or other identifying information into an unfamiliar validator. Do not include such personal data in GA4 ecommerce event parameters. A technically valid event still has to respect consent requirements and the applicable collection policies.

Document event triggers, parameter definitions, and test results before deploying.

Frequently asked ecommerce data layer questions

Does a valid data layer object guarantee that GA4 records the purchase?

No. A data object is an input. GTM mapping, trigger execution, network delivery, consent, and the destination Analytics property all require separate checks.

Must every GA4 item include both an ID and a name?

No. Google’s ecommerce documentation requires at least one of item_id or item_name, although using both is recommended.

Why should an ecommerce object be cleared before the next event?

Clearing it can prevent information from a previous shopping action from being inherited by a later event in GTM’s data model.

Should a purchase value include shipping and tax?

No. For the GA4 ecommerce event value, use the sum of item price multiplied by quantity; report shipping and tax separately when those values are available.