The dataLayer is the contract between your website and your analytics tools. Every piece of tracking data — product impressions, cart actions, conversions, custom interactions — travels through it. Get the contract right and your analytics becomes a reliable foundation for business decisions. Get it wrong and you’re building dashboards on sand.
This section covers everything from naming conventions to platform-specific implementations. Whether you’re designing a new tracking specification, implementing GA4 ecommerce events, or validating what you’ve already built, you’ll find the definitive reference here.
Design your dataLayer right from the start. These articles cover the naming rules, data types, and versioning strategies that determine whether your implementation scales or collapses under its own complexity.
Naming ConventionsThe definitive naming rules for events and parameters — snake_case, reserved prefixes, consistency rules.
Event Naming RulesWhen to use GA4 recommended events vs. custom events, the 40-character limit, and anti-patterns to avoid.
Parameter Naming RulesCustom parameter conventions, GA4 limits, reserved names, and strategies for parameter reuse.
Data TypesStandards for strings, numbers, booleans, arrays, and objects — including common mistakes with prices and currencies.
Versioning StrategyHow to version your dataLayer spec, manage breaking changes, and support multiple versions simultaneously.
Designing Custom EventsA systematic framework for designing new events — decision trees, documentation templates, and review processes.
The GA4 ecommerce event specification defines a funnel from product discovery to purchase. Each event in this section maps directly to a stage in that funnel and connects to the next. Implement them in order — view_item_list feeds select_item, which feeds view_item, which feeds the cart and checkout events, which feed purchase.
Ecommerce OverviewThe complete GA4 ecommerce funnel — event flow, the items array structure, currency handling, and the ecommerce null clear pattern.
view_item_listProduct list impressions — category pages, search results, recommendation widgets.
select_itemUser clicks a product in a list — linking list context to the product detail page.
view_itemProduct detail page views — the full item specification with variants.
add_to_cartAdding products to the cart — quantity handling, quick-add patterns.
remove_from_cartRemoving products from the cart — full removal vs. quantity reduction.
view_cartCart page views — full cart contents with total value calculation.
begin_checkoutCheckout initiation — capturing cart contents and coupon codes at checkout start.
add_shipping_infoShipping step completion — shipping tier and full item details.
add_payment_infoPayment step completion — payment method type and checkout totals.
purchaseOrder confirmation — the most critical event. Deduplication, transaction parameters, and validation.
refundFull and partial refunds — server-side implementation and Measurement Protocol.
Beyond ecommerce, you’ll need events that reflect your specific product interactions. These articles cover the standard patterns for authentication, search, forms, content engagement, and errors — plus a guide to designing your own events from scratch.
Login & Sign UpGA4 recommended login and sign_up events — method parameter, user_id, and privacy considerations.
Platform-specific implementation guides. Each covers the quirks, hooks, and patterns specific to that platform — from Shopify’s Custom Pixels sandbox to WooCommerce’s AJAX cart to Next.js App Router route tracking.
Bad data in equals bad decisions out. These articles cover every layer of the validation stack — from TypeScript compile-time checks to runtime Zod schemas to automated Playwright tests running in CI.
Validation ApproachesThe validation pyramid — development, staging, production. Which tools for which layer.
TypeScript SchemasComplete TypeScript types for the GA4 ecommerce dataLayer — discriminated unions, type-safe push wrappers.
Runtime ValidationZod schemas, dataLayer interceptor pattern, error reporting, dev vs. production modes.
Automated TestingPlaywright and Cypress tests for the complete ecommerce funnel — CI/CD integration.