/iblai-marketing-analytics-tracking
Set up analytics tracking that drives marketing and product decisions. Skip
vanity events; track what changes how the team operates.
Step 0: Context Check
Read .agents/product-marketing-context.md (or .claude/product-marketing-context.md
on older setups) first. Only ask for what isn't there.
Before implementing, pin down:
- Business context — which decisions does this data drive? What counts as a conversion?
- Current state — what tracking already exists? Which tools?
- Technical context — stack, privacy and compliance requirements.
Core Principles
- Track for decisions, not data. Every event informs an action. Quality beats quantity.
- Start with questions. What do you need to know? What will you do with the answer? Work backward to the events.
- Name things consistently. Set conventions before implementing. Document everything.
- Maintain data quality. Validate, monitor, clean. Clean data beats 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 |
Comprehensive event lists: references/event-library.md.
Event Naming Conventions
Format: Object-Action
signup_completed
button_clicked
form_submitted
article_read
checkout_payment_completed
Rules
- Lowercase with underscores
- Be specific:
cta_hero_clicked, not button_clicked
- Push context into properties, not the event name
- No spaces, no special characters
- Document every decision
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 |
Full library by business type: 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 |
Rules
- Consistent property names everywhere
- Include relevant context
- Don't duplicate automatic properties
- No 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'
});
Detailed setup: 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'
});
Detailed setup: references/gtm-implementation.md.
UTM Parameters
Standard Set
| 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 |
Conventions
- Lowercase everything
- Underscores or hyphens — pick one
- Specific but concise (
blog_footer_cta, not cta1)
- Document UTMs in a single spreadsheet
Debugging and Validation
Testing Tools
| Tool |
Use For |
| GA4 DebugView |
Real-time event monitoring |
| GTM Preview Mode |
Test triggers before publishing |
| 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
Rules
- Cookie consent required in EU/UK/CA
- No PII in analytics properties
- Configure data-retention windows
- Support user deletion
Implementation
- Consent mode (wait for consent)
- IP anonymization
- Collect only what you need
- Wire to a 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
- iblai-marketing-ab-test-setup: For experiment tracking
- iblai-marketing-seo-audit: For organic traffic analysis
- iblai-marketing-page-cro: For conversion optimization (uses this data)
- iblai-marketing-revops: For pipeline metrics, CRM tracking, and revenue attribution
1---2name: iblai-marketing-analytics-tracking3description: 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 plan," "how do I measure this," "track conversions," "attribution," "Mixpanel," "Segment," "are my events firing," or "analytics isn't working." Use this whenever someone asks how to know if something is working or wants to measure marketing results. For A/B test measurement, see iblai-marketing-ab-test-setup.4---56# /iblai-marketing-analytics-tracking78Set up analytics tracking that drives marketing and product decisions. Skip9vanity events; track what changes how the team operates.1011## Step 0: Context Check1213Read `.agents/product-marketing-context.md` (or `.claude/product-marketing-context.md`14on older setups) first. Only ask for what isn't there.1516Before implementing, pin down:17181. **Business context** — which decisions does this data drive? What counts as a conversion?192. **Current state** — what tracking already exists? Which tools?203. **Technical context** — stack, privacy and compliance requirements.2122---2324## Core Principles25261. **Track for decisions, not data.** Every event informs an action. Quality beats quantity.272. **Start with questions.** What do you need to know? What will you do with the answer? Work backward to the events.283. **Name things consistently.** Set conventions before implementing. Document everything.294. **Maintain data quality.** Validate, monitor, clean. Clean data beats more data.3031---3233## Tracking Plan Framework3435### Structure3637```38Event Name | Category | Properties | Trigger | Notes39---------- | -------- | ---------- | ------- | -----40```4142### Event Types4344| Type | Examples |45|------|----------|46| Pageviews | Automatic, enhanced with metadata |47| User Actions | Button clicks, form submissions, feature usage |48| System Events | Signup completed, purchase, subscription changed |49| Custom Conversions | Goal completions, funnel stages |5051Comprehensive event lists: [references/event-library.md](references/event-library.md).5253---5455## Event Naming Conventions5657### Format: Object-Action5859```60signup_completed61button_clicked62form_submitted63article_read64checkout_payment_completed65```6667### Rules68- Lowercase with underscores69- Be specific: `cta_hero_clicked`, not `button_clicked`70- Push context into properties, not the event name71- No spaces, no special characters72- Document every decision7374---7576## Essential Events7778### Marketing Site7980| Event | Properties |81|-------|------------|82| cta_clicked | button_text, location |83| form_submitted | form_type |84| signup_completed | method, source |85| demo_requested | - |8687### Product/App8889| Event | Properties |90|-------|------------|91| onboarding_step_completed | step_number, step_name |92| feature_used | feature_name |93| purchase_completed | plan, value |94| subscription_cancelled | reason |9596Full library by business type: [references/event-library.md](references/event-library.md).9798---99100## Event Properties101102### Standard Properties103104| Category | Properties |105|----------|------------|106| Page | page_title, page_location, page_referrer |107| User | user_id, user_type, account_id, plan_type |108| Campaign | source, medium, campaign, content, term |109| Product | product_id, product_name, category, price |110111### Rules112- Consistent property names everywhere113- Include relevant context114- Don't duplicate automatic properties115- No PII in properties116117---118119## GA4 Implementation120121### Quick Setup1221231. Create GA4 property and data stream1242. Install gtag.js or GTM1253. Enable enhanced measurement1264. Configure custom events1275. Mark conversions in Admin128129### Custom Event Example130131```javascript132gtag('event', 'signup_completed', {133 'method': 'email',134 'plan': 'free'135});136```137138Detailed setup: [references/ga4-implementation.md](references/ga4-implementation.md).139140---141142## Google Tag Manager143144### Container Structure145146| Component | Purpose |147|-----------|---------|148| Tags | Code that executes (GA4, pixels) |149| Triggers | When tags fire (page view, click) |150| Variables | Dynamic values (click text, data layer) |151152### Data Layer Pattern153154```javascript155dataLayer.push({156 'event': 'form_submitted',157 'form_name': 'contact',158 'form_location': 'footer'159});160```161162Detailed setup: [references/gtm-implementation.md](references/gtm-implementation.md).163164---165166## UTM Parameters167168### Standard Set169170| Parameter | Purpose | Example |171|-----------|---------|---------|172| utm_source | Traffic source | google, newsletter |173| utm_medium | Marketing medium | cpc, email, social |174| utm_campaign | Campaign name | spring_sale |175| utm_content | Differentiate versions | hero_cta |176| utm_term | Paid search keywords | running+shoes |177178### Conventions179- Lowercase everything180- Underscores or hyphens — pick one181- Specific but concise (`blog_footer_cta`, not `cta1`)182- Document UTMs in a single spreadsheet183184---185186## Debugging and Validation187188### Testing Tools189190| Tool | Use For |191|------|---------|192| GA4 DebugView | Real-time event monitoring |193| GTM Preview Mode | Test triggers before publishing |194| Browser Extensions | Tag Assistant, dataLayer Inspector |195196### Validation Checklist197198- [ ] Events fire on the correct triggers199- [ ] Property values populate correctly200- [ ] No duplicate events201- [ ] Works cross-browser and on mobile202- [ ] Conversions recorded correctly203- [ ] No PII leaking204205### Common Issues206207| Issue | Check |208|-------|-------|209| Events not firing | Trigger config, GTM loaded |210| Wrong values | Variable path, data layer structure |211| Duplicate events | Multiple containers, trigger firing twice |212213---214215## Privacy and Compliance216217### Rules218- Cookie consent required in EU/UK/CA219- No PII in analytics properties220- Configure data-retention windows221- Support user deletion222223### Implementation224- Consent mode (wait for consent)225- IP anonymization226- Collect only what you need227- Wire to a consent management platform228229---230231## Output Format232233### Tracking Plan Document234235```markdown236# [Site/Product] Tracking Plan237238## Overview239- Tools: GA4, GTM240- Last updated: [Date]241242## Events243244| Event Name | Description | Properties | Trigger |245|------------|-------------|------------|---------|246| signup_completed | User completes signup | method, plan | Success page |247248## Custom Dimensions249250| Name | Scope | Parameter |251|------|-------|-----------|252| user_type | User | user_type |253254## Conversions255256| Conversion | Event | Counting |257|------------|-------|----------|258| Signup | signup_completed | Once per session |259```260261---262263## Task-Specific Questions2642651. What tools are you using (GA4, Mixpanel, etc.)?2662. What key actions do you want to track?2673. What decisions will this data inform?2684. Who implements — dev team or marketing?2695. Are there privacy/consent requirements?2706. What's already tracked?271272---273274## Tool Integrations275276For implementation, see the [tools registry](../../tools/REGISTRY.md). Key analytics tools:277278| Tool | Best For | MCP | Guide |279|------|----------|:---:|-------|280| **GA4** | Web analytics, Google ecosystem | ✓ | [ga4.md](../../tools/integrations/ga4.md) |281| **Mixpanel** | Product analytics, event tracking | - | [mixpanel.md](../../tools/integrations/mixpanel.md) |282| **Amplitude** | Product analytics, cohort analysis | - | [amplitude.md](../../tools/integrations/amplitude.md) |283| **PostHog** | Open-source analytics, session replay | - | [posthog.md](../../tools/integrations/posthog.md) |284| **Segment** | Customer data platform, routing | - | [segment.md](../../tools/integrations/segment.md) |285286---287288## Related Skills289290- **iblai-marketing-ab-test-setup**: For experiment tracking291- **iblai-marketing-seo-audit**: For organic traffic analysis292- **iblai-marketing-page-cro**: For conversion optimization (uses this data)293- **iblai-marketing-revops**: For pipeline metrics, CRM tracking, and revenue attribution