🛠️ Not sure how to fix your dataLayer? Talk to us - we can help validate your setup, migrate to GA4, or debug tracking issues.
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.
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.
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.
Parameter | Description | Type | Example | Notes |
---|---|---|---|---|
item_id | Unique identifier for the item | String | SKU_12345 | Required |
item_name | Name of the item | String | Blue T-Shirt | Required |
affiliation | Store or partner name | String | Online Store | Optional |
coupon | Item-level coupon code | String | SUMMER_SALE | Optional |
currency | Currency in ISO 4217 | String | USD | Typically set at event level |
discount | Discount on item | Number | 5.00 | Optional |
index | Position in list | Number | 1 | Optional |
item_brand | Brand name | String | BrandX | Optional |
item_category | Primary category | String | Apparel | Optional |
item_category2 | Secondary category | String | Shirts | Optional |
item_category3 | Third-level category | String | Men’s | Optional |
item_category4 | Fourth-level category | String | Casual | Optional |
item_category5 | Fifth-level category | String | Short-Sleeve | Optional |
item_list_id | ID of the product list | String | category_page_1 | Optional |
item_list_name | Name of the product list | String | Category Page | Optional |
item_variant | Variant (e.g., size, colour) | String | Blue | Optional |
location_id | Physical/virtual location ID | String | store_001 | Optional |
price | Unit price | Number | 29.99 | Required for purchase/cart events |
quantity | Number of units | Number | 2 | Required for purchase/cart events |
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()
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.
Enter your email to access the tool and get early access to future features and insights. We respect your privacy — read our Privacy Policy.
Net Impression is a UK-based analytics consultancy, specialising in advanced GA4, GTM, BigQuery, and conversion rate optimisation for agencies and growth teams.