analytics-tracking-automation — Claude Code skill: GA4 and GTM
A skill that walks the agent through analytics setup: crawl the site, design GA4 events, sync them into GTM, verify in preview, publish the container.
npx skills add reason-machines/data-skills --skill analytics-tracking-automation -a claude-codeWhat analytics-tracking-automation does
The skill hands the agent a six-stage workflow. It crawls the site and sorts pages by purpose — product, pricing, contact. From that it builds a GA4 event schema with parameters and triggers, pushes it into a Google Tag Manager container over the API, runs Playwright checks against preview mode, and publishes the container version once those checks pass.
The event-tracking CLI drives all of it, with init, resume, audit, sync, verify and publish. Every run writes an artifact folder: site-analysis.json, page-groups.json, event-schema.json, verification-report.json, checkpoint.json. You can edit those files and pick up from the last checkpoint instead of starting over. Shopify storefronts get their own mode covering cart, checkout and purchase events.
Syncing to GTM needs Google OAuth credentials — GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET — and the redirect URI has to be http://localhost:3000/oauth/callback. Skip that and sync stops there. Node.js 18+ is required, and Playwright Chromium installs on the first npm install.
What it helps with
- plan GA4 events around how a specific site is built
- compare a live GTM container against a recommended tracking plan
- create GTM tags, triggers and variables without clicking through the UI
- check that events fire in preview before anything goes live
- set up cart and purchase events for a Shopify store
Example prompts for the agent
- Analyze https://www.example.com and draft a GTM tracking plan for it
- Generate a GA4 event schema and sync it to my GTM container
- Audit my GTM container and show where it drifts from the plan
How to install analytics-tracking-automation
1Skills CLI (Vercel)
npx skills add reason-machines/data-skills --skill analytics-tracking-automation -a claude-code2Manually: put the files in place
~/.claude/skills/analytics-tracking-automation/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/analytics-tracking-automation/
1Skills CLI (Vercel)
npx skills add reason-machines/data-skills --skill analytics-tracking-automation -a codex2Manually: put the files in place
.agents/skills/analytics-tracking-automation/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add reason-machines/data-skills --skill analytics-tracking-automation -a cursor2Manually: put the files in place
.cursor/skills/analytics-tracking-automation/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install reason-machines/data-skills analytics-tracking-automation2Manually: put the files in place
.github/skills/analytics-tracking-automation/SKILL.md1Skills CLI (Vercel)
npx skills add reason-machines/data-skills --skill analytics-tracking-automation -a gemini-cli2Platform CLI
gemini skills install https://github.com/reason-machines/data-skills --path skills/analytics-tracking-automationManually: put the files in place
.devin/skills/analytics-tracking-automation/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add reason-machines/data-skills --skill analytics-tracking-automation -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about analytics-tracking-automation
How do I install analytics-tracking-automation in Claude Code?
Run npx skills add reason-machines/data-skills --skill analytics-tracking-automation -a claude-code, then confirm the skill file sits at ~/.claude/skills/analytics-tracking-automation/SKILL.md.
What does analytics-tracking-automation do?
It crawls a site, groups pages by intent, designs a GA4 event schema, writes it into a GTM container, verifies event firing in preview, and publishes the container version.
What do I need before syncing with Google Tag Manager?
Google OAuth credentials: GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET from Google Cloud Console, with the Tag Manager API enabled and redirect URI http://localhost:3000/oauth/callback. The first sync opens a browser for consent.