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:
- If
package.jsonhasplaywright-bddas a dependency → use BDD mode - If the project has
.featurefiles in the test directory → use BDD mode - Otherwise → use Standard mode
Common events it validates:
element_visibility— fires when a component scrolls into viewcta_click— fires when user clicks a CTA button or linkform_interaction— fires on form field focus, input, selection changesform_submit/generate_lead— fires after form submission or conversionselect_content,add_to_cart,purchase— GA4 recommended events- Any custom event name — the framework is not limited to standard events