# Analytics — Marketing Skill for AI Agents

Set up analytics by working backwards from decisions, not data: start with the questions you need answered, then track only the events that inform an action. Name events with a consistent object-action pattern (signup_completed, cta_clicked) in lowercase with underscores, and keep context in properties rather than the event name. For a marketing site plus product, the essentials are cta_clicked, form_submitted, signup_completed, feature_used, and purchase_completed, tagged with standard properties like source, medium, and plan. Validate everything in GA4 DebugView and GTM Preview before shipping, and keep PII out of properties.

> Maintained by Corey Haines · v2.0.1 · Updated 2026-07-22

Install: `npx skills add coreyhaines31/marketingskills`
Source: https://github.com/coreyhaines31/marketingskills/tree/main/skills/analytics

## When to use it

- "set up tracking,"
- "GA4,"
- "Google Analytics,"
- "conversion tracking,"
- "event tracking,"
- "UTM parameters,"
- "tag manager,"
- "GTM,"

## What's inside

**The playbook covers:** Initial Assessment, Core Principles, Tracking Plan Framework, Event Naming Conventions, Essential Events, Event Properties, GA4 Implementation, Google Tag Manager, UTM Parameter Strategy, Debugging and Validation, Privacy and Compliance, Output Format, Overview, Events, Custom Dimensions, Conversions, Task-Specific Questions, Tool Integrations

### Reference library

- [Event Library Reference](https://github.com/coreyhaines31/marketingskills/blob/main/skills/analytics/references/event-library.md) — Comprehensive list of events to track by business type and context.
- [GA4 Implementation Reference](https://github.com/coreyhaines31/marketingskills/blob/main/skills/analytics/references/ga4-implementation.md) — Detailed implementation guide for Google Analytics 4.
- [Google Tag Manager Implementation Reference](https://github.com/coreyhaines31/marketingskills/blob/main/skills/analytics/references/gtm-implementation.md) — Detailed guide for implementing tracking via Google Tag Manager.

## Example

**Prompt:** Help me set up analytics tracking for our B2B SaaS product. We use GA4 and GTM. We need to track signups, feature usage, and upgrade events.

**Tracking plan (excerpt)**

Event            | Properties           | Trigger
signup_completed | method, plan, source | success page
cta_clicked      | button_text, location| CTA click
feature_used     | feature_name         | in-app action
purchase_completed | plan, value        | payment success

**GA4 custom event**

gtag('event', 'signup_completed', {
  'method': 'email',
  'plan': 'free'
});

## FAQ

### How should I name analytics events?

Use an object-action format in lowercase with underscores — signup_completed, form_submitted, cta_hero_clicked. Be specific (cta_hero_clicked beats button_clicked) and push context into properties instead of bloating the event name. Establish the convention before you implement anything and document it, so your events stay consistent and queryable as the plan grows.

### Why don't my GA4 numbers match my database?

Common causes are duplicate tags firing (two GTM containers or a trigger firing twice), consent-mode filtering, ad blockers, and differences between client-side and server-side counting or session timeouts. Debug systematically: watch events in GA4 DebugView, test triggers in GTM Preview, and check for deduplication. Client-side analytics will almost always undercount versus a server-side source of truth.

### What UTM parameters should I use?

Standardize source (google, meta, newsletter), medium (cpc, paid-social, email, organic-social), and campaign (a named convention with a date or identifier), plus content and term where relevant. Keep everything lowercase and consistent, avoid redundant or vague values like "cta1," and log every UTM in a shared spreadsheet so channels stay comparable and reporting doesn't fragment.

## Related skills

- **ab-testing** — For experiment tracking
- **attribution** — For attribution models, multi-touch/MMM/incrementality, and reconciling conflicting numbers across tools (once tracking is live)
- **seo-audit** — For organic traffic analysis
- **cro** — For conversion optimization (uses this data)
- **revops** — For pipeline metrics, CRM tracking, and revenue attribution

---
Canonical: https://marketing-skills.com/skills/analytics