Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>TagLupa Lint — dataLayer & GA4 validatorNew to Visual Studio Code? Get it now.
TagLupa Lint — dataLayer & GA4 validator

TagLupa Lint — dataLayer & GA4 validator

Khevin Georgis Marcelo Caro

|
3 installs
| (0) | Free
| Sponsor
Validate dataLayer.push and gtag GA4 events as you code: ecommerce, value, currency, items and transaction_id. By the makers of TagLupa.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

TagLupa Lint — dataLayer & GA4 validator

Catch Google Analytics 4 and Google Tag Manager tracking bugs while you write the code, not weeks later when the reports look wrong.

TagLupa Lint reads every dataLayer.push(...) and gtag('event', ...) in your project and checks them against the GA4 ecommerce rules, with one-click fixes.

dataLayer.push({
  event: 'purchase',
  ecommerce: {
    value: '120.50',            // ✖ "value" must be a number        → Convert to number
                                // ✖ "value" needs "currency"         → Add currency: 'USD'
    items: [{ price: total.toFixed(2) }]
                                // ✖ Item without item_id / item_name
                                // ⚠ "price" must be a number         → Wrap with Number(…)
  }
});                             // ✖ Missing "transaction_id"
                                // ℹ Push { ecommerce: null } first   → Insert it

Tag inventory and tag map

Open the TagLupa icon in the Activity Bar to see every tag in your project, even when your team wraps dataLayer.push in its own helpers:

// utils/tracking.js
export const sendToData = (name, payload) => window.dataLayer.push({ event: name, event_data: payload });

// pages/Login.jsx
import { sendToData as track } from '@/utils/tracking';
track('login', { method: 'google' });   // → login · Login.jsx:3 · via sendToData() → dataLayer (GTM-ABC123)
  • Finds helpers automatically (exported functions, default exports, re-exports, hooks such as useCallback, object methods, CommonJS) and follows imports, including tsconfig/jsconfig path aliases.
  • Resolves event names from constants and TypeScript enums (EVENTS.PURCHASE, Events.Purchase).
  • Tells helpers and destinations apart: several dataLayers (dataLayer, dataLayerShop…) with their GTM container IDs, gtag with its measurement IDs, and libraries such as @next/third-parties, react-gtm-module, vue-gtm and react-ga4.
  • Group the inventory by event, by destination and function or by file. Click any tag to open the code.
  • Tag map: an interactive graph (files → functions → events → helpers → destinations) in an editor tab. Click a node to highlight its tags, double click to open the code, search, filter, and switch between a layered view, a free network view and a 3D view you can rotate and zoom (with auto-rotate). Nodes with lint errors are shown in red.
  • Always at hand: the status bar shows how many tags the project has (click to open the map), and a CodeLens above each helper tells you how many tags use it.
  • Export the inventory to CSV or JSON: a measurement plan draft straight from the code.
  • Everything runs locally and offline.

Layers: files → functions → events → helpers → destinations, left to right.

Tag map, layered view

Network: a free layout. Click a node (here the track() helper) to highlight only the tags it shares and see every tag that goes through it.

Tag map, network view with a helper selected

3D: rotate, zoom and fly through the whole tracking setup.

Tag map, 3D view

Features

  • Diagnostics in the editor and the Problems panel, in English or Spanish (follows the VS Code display language).
  • Quick fixes (💡): convert strings to numbers, add currency, uppercase currency codes, insert { ecommerce: null }, rename events to snake_case.
  • Autocomplete for GA4 recommended event names after event: ' and gtag('event', '.
  • Snippets for every GA4 ecommerce event: type ga4-purchase, ga4-add_to_cart, ga4-view_item…
  • Works in JavaScript, TypeScript, JSX/TSX, HTML, Vue, Svelte, Astro, PHP, Blade, Liquid (Shopify), Handlebars and Twig. Template tags such as {{ order.total }} or <?= $id ?> are understood as server values.
  • Runs offline. Your code never leaves your computer.

Rules

Rule Severity What it checks
ecommerce-missing Error Ecommerce event without an ecommerce object
items-missing, items-empty Error items missing or empty
value-not-number Error value is text (e.g. '9.90' or price.toFixed(2))
value-without-currency Error value without currency
transaction-id-missing Error purchase / refund without transaction_id
item-missing-id Error Item without item_id or item_name
item-not-object Error An element of items is not an object
event-not-string Error event is not a string
required-param Error Your own required parameters (see settings)
currency-format Warning currency is not an uppercase ISO 4217 code
transaction-id-hardcoded Warning Fixed transaction_id: every order would share it
purchase-value-missing Warning purchase without value
item-price-not-number Warning price is text
item-quantity-invalid Warning quantity is not a positive integer
ua-ecommerce Warning Universal Analytics ecommerce format (UA was shut down in 2023)
event-name-reserved Warning firebase_, google_ or ga_ prefix
undefined-value Warning A parameter set to undefined
ecommerce-not-cleared Info No { ecommerce: null } right before the event
event-name-format, event-name-length Info GA4 naming rules (letters, numbers, _, max. 40)
value-total-mismatch Info value ≠ Σ price × quantity

TagLupa Lint only reports what it can prove from the code: if an object uses a spread (...payload) or a value comes from a variable, it does not guess.

Settings

Setting Default
taglupaLint.dataLayerNames ["dataLayer"] Names of your dataLayer arrays
taglupaLint.requiredParams {} e.g. { "login": ["method"], "purchase": ["ecommerce.transaction_id", "user_id"] }
taglupaLint.defaultCurrency "USD" Currency used by the Add currency quick fix
taglupaLint.disabledRules [] e.g. ["ecommerce-not-cleared"]
taglupaLint.statusBar true Number of tags in the status bar
taglupaLint.codeLens true CodeLens above tracking helpers
taglupaLint.inventory.exclude [] Extra globs excluded from the inventory

Disable a rule for one line:

// taglupa-lint-disable-next-line transaction-id-hardcoded
gtag('event', 'purchase', { transaction_id: 'TEST_ORDER', ... });

Or for a whole file: /* taglupa-lint-disable */.

Test it live: TagLupa for Chrome

The code is right; does the site really send it? TagLupa is the browser extension that shows every dataLayer event live on any website, validates GA4 and ecommerce, and exports QA reports.

Support

TagLupa Lint is free, and I build it in my free time. If it saved you from a broken report, you can buy me a coffee: it helps me keep adding rules and features. Thank you! ☕

Support me on Ko-fi


En español: TagLupa Lint revisa tus dataLayer.push y gtag('event', …) mientras programas. Los avisos salen en español si VS Code está en español.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft