gtm-datalayer-fundamentals

Implement data layer events and GA4 migration patterns for GTM tagging.

77|9|Updated Oct 10, 2025
One-click install
npx skills add https://github.com/henkisdabro/claudecode-marketplace --skill gtm-datalayer-fundamentals
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gtm-datalayer-fundamentals
Source: https://github.com/henkisdabro/claudecode-marketplace/tree/main/gtm-suite/skills/gtm-datalayer/references/datalayer-fundamentals.md
Command: npx skills add https://github.com/henkisdabro/claudecode-marketplace --skill gtm-datalayer-fundamentals

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Guidance explains what a data layer is, why it matters, and how to structure and push data reliably for GTM tagging.

Core Features & Use Cases

  • Core Concepts: Initialization, dataLayer.push usage, event-driven data.
  • Data Layer Patterns: Common payload shapes for events like purchase or custom events.
  • Best Practices: Sequencing and data integrity.

Quick Start

Add a basic dataLayer initialization snippet and push a simple event with a few parameters.

Frequently Asked Questions about gtm-datalayer-fundamentals

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is a data layer and why do I need one for GTM?

A data layer is a JavaScript object that stores event and website data in a standardized format for Google Tag Manager to access. It enables reliable event tracking, ecommerce data collection, and GA4 migration by decoupling data from tags, ensuring consistent naming conventions and proper initialization order across your site.

How do I set up and push events to the dataLayer?

Initialize the dataLayer as a global array, then use dataLayer.push() to send event objects with key-value pairs. Start with basic initialization snippets, structure events consistently with required parameters, and maintain proper sequencing to satisfy GTM tag dependencies and data integrity requirements.

Can I use a data layer with single-page applications like React or Vue?

Yes, data layers work with React, Vue, Angular, and Next.js. SPAs require special handling for event-driven data layer updates since page reloads don't reset the dataLayer. Push events on route changes and user interactions rather than relying on page load triggers.

How do I structure ecommerce data in the dataLayer for GA4?

Use standard ecommerce data structures with consistent field names for purchase events, product lists, and transactions. The data layer enforces naming conventions and payload shapes that GA4 expects, enabling accurate tracking without tag-level data transformation.

What are common mistakes when implementing data layer events?

Initialization order matters—push the dataLayer object before GTM container snippet loads. Use consistent naming conventions across all events, validate dataLayer.push timing, and document event payloads. Incorrect sequencing breaks tag firing and causes data gaps in GA4.

How do I debug data layer issues and verify events are being tracked?

Check browser console for dataLayer contents, use GTM's preview mode, and verify event timing against container loading. Documentation of event structure and payload validation ensures reliable debugging and identifies initialization or naming convention violations.