🛠️ Not sure how to fix your dataLayer? Talk to us - we can help validate your setup, migrate to GA4, or debug tracking issues.

DataLayer Inspector - Validate & Improve Your GA4 Ecommerce Tracking

Easily inspect your website’s ecommerce tracking setup by validating your dataLayer.push() code. Spot missing fields, incorrect formats, and structural issues based on Google’s GA4 best practices. Paste your code below, get instant feedback, and improve your tracking with confidence.

Explore GA4 Ecommerce Schema Examples

Use this tool to explore example dataLayer.push() formats for common GA4 ecommerce events like view_item, add_to_cart, and purchase. You can select a schema from the dropdown to preview its recommended structure and field comments.

Reference: GA4 Item Parameters Explained

The table below lists all supported GA4 item parameters. You can toggle it open to explore what each field means, what data type is expected, and whether it’s required or optional for proper ecommerce tracking.

Extract Ecommerce Events from Your Site

To extract ecommerce tracking data directly from your site, open your browser's developer console (usually by pressing F12 or Right Click → Inspect → Console) and paste the following code snippet. This will return any ecommerce-related dataLayer.push() entries from the current page, which you can then copy and paste into the validator below.

If you are having troube, try typing 'allow pasting' into the console first.

dataLayer.forEach((entry, i) => {
  let ecommerceEntry = null;

  // Case 1: Plain object with ecommerce
  if (entry && typeof entry === 'object' && entry.ecommerce) {
    ecommerceEntry = entry;
  }

  // Case 2: Arguments-like object with ecommerce inside the 3rd param
  else if (
    Object.prototype.toString.call(entry) === '[object Arguments]' &&
    typeof entry[2] === 'object' &&
    entry[2] !== null &&
    entry[2].items // or entry[2].ecommerce if it's standard ecommerce structure
  ) {
    ecommerceEntry = {
      event: entry[1] || 'unknown_event',
      ecommerce: {
        ...entry[2]
      }
    };
  }

  if (ecommerceEntry) {
    const formatted = JSON.stringify(ecommerceEntry, null, 2);
    console.log(`// Ecommerce Push ${i + 1}\ndataLayer.push(${formatted});\n`);
  }
});

Paste your dataLayer.push() below:

Paste your dataLayer.push() object into the box below. When you click Validate, we’ll check the structure and value types against GA4 best practices to flag any issues, missing fields, or type mismatches. This helps ensure your dataLayer is clean, complete, and ready for accurate tracking.

Not sure where to start?

Whether you need to fix your tracking, improve your reporting, or run better experiments, we help businesses of all sizes turn analytics and CRO into a real growth engine. Get in touch to see how better data and faster testing can accelerate your results.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.