Toolvito

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

Pushes, events, the ecommerce object and your own rules.

Your values

A JSON array of pushes (as window.dataLayer holds them), JSON Lines, or page code with dataLayer.push() calls.

One event per line: the event, a colon, then the keys it needs, with a type if you like: purchase: ecommerce.transaction_id, ecommerce.value:number. Types: text, number, integer, boolean, list, object, currency. Use * for every event.

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.

Check large files of pushes

Check large files of pushes

Choose up to 20 JSON or JSON Lines files of up to 100 MB each, such as data layers recorded by a crawler or a test run. Every push is checked with the rules above and your own rules typed here, and you get the problems and a count for each event as CSV files.

Or drop files here. JSON, JSONL, NDJSON or TXT, up to 20 files, 100 MB each at most.

    One event per line, such as purchase: ecommerce.transaction_id, ecommerce.value:number.

    The data layer above is checked in your browser. When you use this box, the files you choose and the rules typed in the box are sent to the Toolvito server. Download the result within one hour after the job finishes. Choose Delete files now to request earlier removal. The hourly cleanup normally removes files within one to two hours after completion.

    How to use it

    1. In your browser’s console, type copy(JSON.stringify(dataLayer)) to copy the data layer, or open your page code.
    2. Paste it, and add your own rules if you like, such as purchase: ecommerce.transaction_id, ecommerce.value:number.
    3. Press Check the data layer and read the problems: each names the push, the event and the key.
    4. 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).

    Related tools