datalayer-analytics-playwright

Installation
SKILL.md

DataLayer Validation — Automated Analytics Testing

Overview

This skill creates automated tests that validate window.dataLayer events (GTM/Google Analytics) using Playwright. It supports two test modes — Standard Playwright (default) and BDD (playwright-bdd). It verifies that tracking events fire correctly with the right payloads when users interact with components.

Mode detection — check BEFORE creating files:

  1. If package.json has playwright-bdd as a dependency → use BDD mode
  2. If the project has .feature files in the test directory → use BDD mode
  3. Otherwise → use Standard mode

Common events it validates:

  • element_visibility — fires when a component scrolls into view
  • cta_click — fires when user clicks a CTA button or link
  • form_interaction — fires on form field focus, input, selection changes
  • form_submit / generate_lead — fires after form submission or conversion
  • select_content, add_to_cart, purchase — GA4 recommended events
  • Any custom event name — the framework is not limited to standard events
Installs
1
First Seen
Mar 2, 2026