Analytics Tracking
When to Use
Use this skill when you need when the user wants to set up, improve, or audit analytics tracking and measurement. Also use when the user mentions "set up tracking," "GA4," "Google Analytics," "conversion tracking," "event tracking," "UTM parameters," "tag manager," "GTM," "analytics implementation," "tracking...
You are an expert in analytics implementation and measurement. Your goal is to help set up tracking that provides actionable insights for marketing and product decisions.
Initial Assessment
Check for product marketing context first:
If .agents/product-marketing.md exists (or .claude/product-marketing.md, or the legacy product-marketing-context.md filename, in older setups), read it before asking questions. Use that context and only ask for information not already covered or specific to this task.
Before implementing tracking, understand:
- Business Context - What decisions will this data inform? What are key conversions?
- Current State - What tracking exists? What tools are in use?
- Technical Context - What's the tech stack? Any privacy/compliance requirements?
Core Principles
1. Track for Decisions, Not Data
- Every event should inform a decision
- Avoid vanity metrics
- Quality > quantity of events
2. Start with the Questions
- What do you need to know?
- What actions will you take based on this data?
- Work backwards to what you need to track
3. Name Things Consistently
- Naming conventions matter
- Establish patterns before implementing
- Document everything
4. Maintain Data Quality
- Validate implementation
- Monitor for issues
- Clean data > more data
Tracking Plan Framework
Structure
Event Name | Category | Properties | Trigger | Notes
---------- | -------- | ---------- | ------- | -----
Event Types
| Type |
Examples |
| Pageviews |
Automatic, enhanced with metadata |
| User Actions |
Button clicks, form submissions, feature usage |
| System Events |
Signup completed, purchase, subscription changed |
| Custom Conversions |
Goal completions, funnel stages |
For comprehensive event lists: See references/event-library.md
Event Naming Conventions
Recommended Format: Object-Action
signup_completed
button_clicked
form_submitted
article_read
checkout_payment_completed
Best Practices
- Lowercase with underscores
- Be specific:
cta_hero_clicked vs. button_clicked
- Include context in properties, not event name
- Avoid spaces and special characters
- Document decisions
Essential Events
Marketing Site
| Event |
Properties |
| cta_clicked |
button_text, location |
| form_submitted |
form_type |
| signup_completed |
method, source |
| demo_requested |
- |
Product/App
| Event |
Properties |
| onboarding_step_completed |
step_number, step_name |
| feature_used |
feature_name |
| purchase_completed |
plan, value |
| subscription_cancelled |
reason |
For full event library by business type: See references/event-library.md
Event Properties
Standard Properties
| Category |
Properties |
| Page |
page_title, page_location, page_referrer |
| User |
user_id, user_type, account_id, plan_type |
| Campaign |
source, medium, campaign, content, term |
| Product |
product_id, product_name, category, price |
Best Practices
- Use consistent property names
- Include relevant context
- Don't duplicate automatic properties
- Avoid PII in properties
GA4 Implementation
Quick Setup
- Create GA4 property and data stream
- Install gtag.js or GTM
- Enable enhanced measurement
- Configure custom events
- Mark conversions in Admin
Custom Event Example
gtag('event', 'signup_completed', {
'method': 'email',
'plan': 'free'
});
For detailed GA4 implementation: See references/ga4-implementation.md
Google Tag Manager
Container Structure
| Component |
Purpose |
| Tags |
Code that executes (GA4, pixels) |
| Triggers |
When tags fire (page view, click) |
| Variables |
Dynamic values (click text, data layer) |
Data Layer Pattern
dataLayer.push({
'event': 'form_submitted',
'form_name': 'contact',
'form_location': 'footer'
});
For detailed GTM implementation: See references/gtm-implementation.md
UTM Parameter Strategy
Standard Parameters
| Parameter |
Purpose |
Example |
| utm_source |
Traffic source |
google, newsletter |
| utm_medium |
Marketing medium |
cpc, email, social |
| utm_campaign |
Campaign name |
spring_sale |
| utm_content |
Differentiate versions |
hero_cta |
| utm_term |
Paid search keywords |
running+shoes |
Naming Conventions
- Lowercase everything
- Use underscores or hyphens consistently
- Be specific but concise:
blog_footer_cta, not cta1
- Document all UTMs in a spreadsheet
Debugging and Validation
Testing Tools
| Tool |
Use For |
| GA4 DebugView |
Real-time event monitoring |
| GTM Preview Mode |
Test triggers before publish |
| Browser Extensions |
Tag Assistant, dataLayer Inspector |
Validation Checklist
Common Issues
| Issue |
Check |
| Events not firing |
Trigger config, GTM loaded |
| Wrong values |
Variable path, data layer structure |
| Duplicate events |
Multiple containers, trigger firing twice |
Privacy and Compliance
Considerations
- Cookie consent required in EU/UK/CA
- No PII in analytics properties
- Data retention settings
- User deletion capabilities
Implementation
- Use consent mode (wait for consent)
- IP anonymization
- Only collect what you need
- Integrate with consent management platform
Output Format
Tracking Plan Document
# [Site/Product] Tracking Plan
## Overview
- Tools: GA4, GTM
- Last updated: [Date]
## Events
| Event Name | Description | Properties | Trigger |
|------------|-------------|------------|---------|
| signup_completed | User completes signup | method, plan | Success page |
## Custom Dimensions
| Name | Scope | Parameter |
|------|-------|-----------|
| user_type | User | user_type |
## Conversions
| Conversion | Event | Counting |
|------------|-------|----------|
| Signup | signup_completed | Once per session |
Task-Specific Questions
- What tools are you using (GA4, Mixpanel, etc.)?
- What key actions do you want to track?
- What decisions will this data inform?
- Who implements - dev team or marketing?
- Are there privacy/consent requirements?
- What's already tracked?
Tool Integrations
For implementation, see the tools registry. Key analytics tools:
| Tool |
Best For |
MCP |
Guide |
| GA4 |
Web analytics, Google ecosystem |
✓ |
ga4.md |
| Mixpanel |
Product analytics, event tracking |
- |
mixpanel.md |
| Amplitude |
Product analytics, cohort analysis |
- |
amplitude.md |
| PostHog |
Open-source analytics, session replay |
- |
posthog.md |
| Segment |
Customer data platform, routing |
- |
segment.md |
Related Skills
- ab-testing: For experiment tracking
- seo-audit: For organic traffic analysis
- cro: For conversion optimization (uses this data)
- revops: For pipeline metrics, CRM tracking, and revenue attribution
Limitations
- Use this skill only when the task clearly matches its upstream source and local project context.
- Verify commands, generated code, dependencies, credentials, and external service behavior before applying changes.
- Do not treat examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.
1---2name: analytics3description: When the user wants to set up, improve, or audit analytics tracking and measurement. Also use when the user mentions "set up tracking," "GA4," "Google Analytics," "conversion tracking," "event tracking," "UTM parameters," "tag manager," "GTM," "analytics implementation," "tracking...4license: MIT5---67# Analytics Tracking8## When to Use910Use this skill when you need when the user wants to set up, improve, or audit analytics tracking and measurement. Also use when the user mentions "set up tracking," "GA4," "Google Analytics," "conversion tracking," "event tracking," "UTM parameters," "tag manager," "GTM," "analytics implementation," "tracking...111213You are an expert in analytics implementation and measurement. Your goal is to help set up tracking that provides actionable insights for marketing and product decisions.1415## Initial Assessment1617**Check for product marketing context first:**18If `.agents/product-marketing.md` exists (or `.claude/product-marketing.md`, or the legacy `product-marketing-context.md` filename, in older setups), read it before asking questions. Use that context and only ask for information not already covered or specific to this task.1920Before implementing tracking, understand:21221. **Business Context** - What decisions will this data inform? What are key conversions?232. **Current State** - What tracking exists? What tools are in use?243. **Technical Context** - What's the tech stack? Any privacy/compliance requirements?2526---2728## Core Principles2930### 1. Track for Decisions, Not Data31- Every event should inform a decision32- Avoid vanity metrics33- Quality > quantity of events3435### 2. Start with the Questions36- What do you need to know?37- What actions will you take based on this data?38- Work backwards to what you need to track3940### 3. Name Things Consistently41- Naming conventions matter42- Establish patterns before implementing43- Document everything4445### 4. Maintain Data Quality46- Validate implementation47- Monitor for issues48- Clean data > more data4950---5152## Tracking Plan Framework5354### Structure5556```57Event Name | Category | Properties | Trigger | Notes58---------- | -------- | ---------- | ------- | -----59```6061### Event Types6263| Type | Examples |64|------|----------|65| Pageviews | Automatic, enhanced with metadata |66| User Actions | Button clicks, form submissions, feature usage |67| System Events | Signup completed, purchase, subscription changed |68| Custom Conversions | Goal completions, funnel stages |6970**For comprehensive event lists**: See [references/event-library.md](references/event-library.md)7172---7374## Event Naming Conventions7576### Recommended Format: Object-Action7778```79signup_completed80button_clicked81form_submitted82article_read83checkout_payment_completed84```8586### Best Practices87- Lowercase with underscores88- Be specific: `cta_hero_clicked` vs. `button_clicked`89- Include context in properties, not event name90- Avoid spaces and special characters91- Document decisions9293---9495## Essential Events9697### Marketing Site9899| Event | Properties |100|-------|------------|101| cta_clicked | button_text, location |102| form_submitted | form_type |103| signup_completed | method, source |104| demo_requested | - |105106### Product/App107108| Event | Properties |109|-------|------------|110| onboarding_step_completed | step_number, step_name |111| feature_used | feature_name |112| purchase_completed | plan, value |113| subscription_cancelled | reason |114115**For full event library by business type**: See [references/event-library.md](references/event-library.md)116117---118119## Event Properties120121### Standard Properties122123| Category | Properties |124|----------|------------|125| Page | page_title, page_location, page_referrer |126| User | user_id, user_type, account_id, plan_type |127| Campaign | source, medium, campaign, content, term |128| Product | product_id, product_name, category, price |129130### Best Practices131- Use consistent property names132- Include relevant context133- Don't duplicate automatic properties134- Avoid PII in properties135136---137138## GA4 Implementation139140### Quick Setup1411421. Create GA4 property and data stream1432. Install gtag.js or GTM1443. Enable enhanced measurement1454. Configure custom events1465. Mark conversions in Admin147148### Custom Event Example149150```javascript151gtag('event', 'signup_completed', {152 'method': 'email',153 'plan': 'free'154});155```156157**For detailed GA4 implementation**: See [references/ga4-implementation.md](references/ga4-implementation.md)158159---160161## Google Tag Manager162163### Container Structure164165| Component | Purpose |166|-----------|---------|167| Tags | Code that executes (GA4, pixels) |168| Triggers | When tags fire (page view, click) |169| Variables | Dynamic values (click text, data layer) |170171### Data Layer Pattern172173```javascript174dataLayer.push({175 'event': 'form_submitted',176 'form_name': 'contact',177 'form_location': 'footer'178});179```180181**For detailed GTM implementation**: See [references/gtm-implementation.md](references/gtm-implementation.md)182183---184185## UTM Parameter Strategy186187### Standard Parameters188189| Parameter | Purpose | Example |190|-----------|---------|---------|191| utm_source | Traffic source | google, newsletter |192| utm_medium | Marketing medium | cpc, email, social |193| utm_campaign | Campaign name | spring_sale |194| utm_content | Differentiate versions | hero_cta |195| utm_term | Paid search keywords | running+shoes |196197### Naming Conventions198- Lowercase everything199- Use underscores or hyphens consistently200- Be specific but concise: `blog_footer_cta`, not `cta1`201- Document all UTMs in a spreadsheet202203---204205## Debugging and Validation206207### Testing Tools208209| Tool | Use For |210|------|---------|211| GA4 DebugView | Real-time event monitoring |212| GTM Preview Mode | Test triggers before publish |213| Browser Extensions | Tag Assistant, dataLayer Inspector |214215### Validation Checklist216217- [ ] Events firing on correct triggers218- [ ] Property values populating correctly219- [ ] No duplicate events220- [ ] Works across browsers and mobile221- [ ] Conversions recorded correctly222- [ ] No PII leaking223224### Common Issues225226| Issue | Check |227|-------|-------|228| Events not firing | Trigger config, GTM loaded |229| Wrong values | Variable path, data layer structure |230| Duplicate events | Multiple containers, trigger firing twice |231232---233234## Privacy and Compliance235236### Considerations237- Cookie consent required in EU/UK/CA238- No PII in analytics properties239- Data retention settings240- User deletion capabilities241242### Implementation243- Use consent mode (wait for consent)244- IP anonymization245- Only collect what you need246- Integrate with consent management platform247248---249250## Output Format251252### Tracking Plan Document253254```markdown255# [Site/Product] Tracking Plan256257## Overview258- Tools: GA4, GTM259- Last updated: [Date]260261## Events262263| Event Name | Description | Properties | Trigger |264|------------|-------------|------------|---------|265| signup_completed | User completes signup | method, plan | Success page |266267## Custom Dimensions268269| Name | Scope | Parameter |270|------|-------|-----------|271| user_type | User | user_type |272273## Conversions274275| Conversion | Event | Counting |276|------------|-------|----------|277| Signup | signup_completed | Once per session |278```279280---281282## Task-Specific Questions2832841. What tools are you using (GA4, Mixpanel, etc.)?2852. What key actions do you want to track?2863. What decisions will this data inform?2874. Who implements - dev team or marketing?2885. Are there privacy/consent requirements?2896. What's already tracked?290291---292293## Tool Integrations294295For implementation, see the [tools registry](https://github.com/coreyhaines31/marketingskills/tree/main/skills/analytics/../../tools/REGISTRY.md). Key analytics tools:296297| Tool | Best For | MCP | Guide |298|------|----------|:---:|-------|299| **GA4** | Web analytics, Google ecosystem | ✓ | [ga4.md](https://github.com/coreyhaines31/marketingskills/tree/main/skills/analytics/../../tools/integrations/ga4.md) |300| **Mixpanel** | Product analytics, event tracking | - | [mixpanel.md](https://github.com/coreyhaines31/marketingskills/tree/main/skills/analytics/../../tools/integrations/mixpanel.md) |301| **Amplitude** | Product analytics, cohort analysis | - | [amplitude.md](https://github.com/coreyhaines31/marketingskills/tree/main/skills/analytics/../../tools/integrations/amplitude.md) |302| **PostHog** | Open-source analytics, session replay | - | [posthog.md](https://github.com/coreyhaines31/marketingskills/tree/main/skills/analytics/../../tools/integrations/posthog.md) |303| **Segment** | Customer data platform, routing | - | [segment.md](https://github.com/coreyhaines31/marketingskills/tree/main/skills/analytics/../../tools/integrations/segment.md) |304305---306307## Related Skills308309- **ab-testing**: For experiment tracking310- **seo-audit**: For organic traffic analysis311- **cro**: For conversion optimization (uses this data)312- **revops**: For pipeline metrics, CRM tracking, and revenue attribution313314## Limitations315316- Use this skill only when the task clearly matches its upstream source and local project context.317- Verify commands, generated code, dependencies, credentials, and external service behavior before applying changes.318- Do not treat examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.