# analytics-tracking

> A Claude Code skill that designs tracking plans, GA4 and GTM implementations, UTM conventions, and event taxonomies so marketing decisions sit on data you can trust.

**Use case**: Set up analytics that survive a real audit

**Canonical URL**: https://agentcookbooks.com/skills/analytics-tracking/

**Topics**: claude-code, skills, marketing, analytics

**Trigger phrases**: "set up tracking", "GA4 implementation", "tracking plan", "are my events firing", "track conversions"

**Source**: [Corey Haines](https://github.com/coreyhaines31/marketingskills/tree/main/skills/analytics-tracking)

**License**: MIT

---

## What it does

`analytics-tracking` is a Claude Code skill from Corey Haines's [marketing-skills repo](https://github.com/coreyhaines31/marketingskills). It turns Claude into a measurement engineer who builds tracking plans backwards from the decisions you'll make — not from a wishlist of events. The skill activates when you mention "set up tracking", "GA4", "GTM", or "track conversions", and walks through tracking-plan design, naming conventions, GA4 event configuration, GTM data layer, and UTM strategy.

The output of a session is a tracking plan document: event names, properties, triggers, custom dimensions, and conversions, plus a GA4/GTM implementation snippet for each event and a UTM-naming spreadsheet template.

## When to use it

Reach for it when:

- You're setting up GA4 from scratch and don't want to inherit twelve years of bad event names
- An audit found duplicate events, missing conversions, or PII leaking through properties
- Marketing keeps asking "did that work?" and nobody can answer

When *not* to reach for it:

- You need attribution modeling specifically — that's a separate analytical question
- You're debugging a single broken pixel; this is structural, not surgical

## Install

The skill is distributed via Corey Haines's [marketing-skills repo](https://github.com/coreyhaines31/marketingskills). Install via the repo's recommended path — copy the [`analytics-tracking` SKILL.md](https://github.com/coreyhaines31/marketingskills/tree/main/skills/analytics-tracking) into your project's `.claude/skills/analytics-tracking/` directory, or use the repo's plugin install if you've set it up.

Once installed, the skill activates on the trigger phrases above. The first time it runs, it will check for `.agents/product-marketing-context.md` (or `.claude/product-marketing-context.md`) — populating that file with your product context first dramatically improves output quality across all of Haines's marketing skills.

## What a session looks like

A typical session has three phases:

1. **Decisions before events.** Claude won't list events until you've named the decisions the data must inform. "Should we keep running this campaign?" → conversion event. "Where do users drop off?" → funnel events.
2. **Naming + structure.** Object-action naming (signup_completed, form_submitted, cta_clicked), property conventions, and a tracking plan table that becomes your source of truth.
3. **Implementation + validation.** GA4 and GTM snippets for each event, a debug checklist (DebugView, Tag Assistant), and a privacy review pass to keep PII out of properties.

The discipline that makes it work: every event has to map to a decision someone will make. The skill aggressively cuts vanity events that nobody will ever query.

## Receipts

Honest reporting on what `analytics-tracking` produces and where it has limits:

**Where it works well:**
- Catches naming chaos before it ossifies — renaming events later is painful
- The decisions-first framing prevents the 80-event taxonomy that nobody understands
- The PII pass surfaces email-in-properties before privacy review does

**Where it backfires:**
- It assumes you're using GA4/GTM-flavored stacks; on Mixpanel-only or Segment-routed setups some patterns need translation
- The tracking plan is only as good as the implementation review — the skill produces the plan, your dev team has to ship it

**Pattern that works:** run it before you migrate from UA to GA4, not after. Building the tracking plan first makes the migration mechanical instead of forensic.

## Source and attribution

Originally written by [Corey Haines](https://corey.co). The canonical SKILL.md and any supporting files live in the [`analytics-tracking` folder](https://github.com/coreyhaines31/marketingskills/tree/main/skills/analytics-tracking) of his [marketing-skills repository](https://github.com/coreyhaines31/marketingskills).

License: MIT. You can install, adapt, and redistribute the skill, with attribution preserved.

This page documents the skill from a practitioner's perspective. For the formal spec and any updates, defer to the source repo.