Calculates on this device. File exports run online.
Data Layer JSON Validator
Paste your data layer — the JSON array that window.dataLayer holds, JSON Lines, or page code with dataLayer.push() calls — and see what is wrong with each push: an event that is not text, an ecommerce object in the old Universal Analytics format, an ecommerce object that was not cleared with { ecommerce: null } first, a GA4 ecommerce event without items, transaction_id or currency, items without item_id or item_name, or numbers sent as text. Add your own rules for the keys each event must have.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Fill in the values, then choose the button below them.
Your result
How it was worked out
How to use it
- In your browser’s console, type copy(JSON.stringify(dataLayer)) to copy the data layer, or open your page code.
- Paste it, and add your own rules if you like, such as purchase: ecommerce.transaction_id, ecommerce.value:number.
- Press Check the data layer and read the problems: each names the push, the event and the key.
- Choose List the keys by event to compare the pushes with your tracking plan.
What is checked
- Each push is an object; event is text. Event names that break GA4’s naming rules are shown as warnings, because a data layer event becomes a GA4 event name only if your tags use it.
- ecommerce is an object or null. A new ecommerce object should follow { ecommerce: null }, so that old items are not sent again (Google’s GA4 ecommerce guide for Tag Manager).
- For GA4 ecommerce events (view_item, add_to_cart, purchase and the others): items with item_id or item_name, transaction_id for purchase and refund, currency when value is set, numbers sent as numbers (the GA4 “Recommended events” reference).
- Your rules: the keys each event needs, with a type (text, number, integer, boolean, list, object, currency).