Analytics Setup
You are setting up product analytics that answer real business questions. Your goal is to create a tracking plan that captures meaningful user behavior without drowning in noise.
Process
1. Define Key Questions
Before adding any tracking code, list the top 5 questions you need to answer:
- Are users activating? (Reaching the "aha moment")
- Are users coming back? (Retention)
- Where do users drop off? (Funnel leaks)
- Which features drive engagement? (Feature adoption)
- What brings users to the product? (Attribution)
2. Design the Event Taxonomy
Use a consistent naming convention:
[object]_[action]
Examples:
- page_viewed
- signup_started
- signup_completed
- feature_used
- subscription_started
- subscription_cancelled
- error_occurred
Rules:
- Past tense for completed actions (
signup_completed not signup)
- Snake_case, lowercase
- Object first, then action
- Include properties for context, not in the event name
3. Core Events (Every Product Needs These)
// Identification
analytics.identify(userId, {
email: user.email,
created_at: user.createdAt,
plan: user.plan,
});
// Page / Screen Views
analytics.page('Dashboard');
// Activation Funnel
analytics.track('signup_started', { source: 'landing_page' });
analytics.track('signup_completed', { method: 'google_oauth' });
analytics.track('onboarding_step_completed', { step: 1, step_name: 'create_workspace' });
analytics.track('activation_completed'); // User hit the "aha moment"
// Feature Usage
analytics.track('feature_used', {
feature_name: 'export_csv',
context: 'dashboard',
});
// Revenue
analytics.track('subscription_started', {
plan: 'pro',
billing_cycle: 'annual',
mrr: 29,
});
4. Platform Selection Guide
| Tool |
Best For |
Price |
| PostHog |
Self-hosted, open source, full suite |
Free (self-hosted) |
| Mixpanel |
Event analytics, funnels, retention |
Free up to 20M events |
| Amplitude |
Product analytics at scale |
Free up to 10M events |
| GA4 |
Marketing analytics, attribution |
Free |
| Plausible |
Privacy-friendly, simple web analytics |
$9/mo |
Recommendation for startups: PostHog (self-hosted) or Mixpanel (free tier) for product analytics + GA4 for marketing attribution. Don't use GA4 alone — it's not built for product analytics.
5. Implementation Checklist
Anti-Patterns
- Tracking everything — 200 events where 20 would do. More events = more noise.
- No naming convention —
click_button, buttonClick, btn_clicked for the same thing
- Tracking PII in events — Never include email, IP, or personal data in event properties
- No documentation — Events tracked but nobody knows what they mean
- Analytics as afterthought — Added after launch, missing the most valuable early data
1---2name: analytics-setup3description: When the user needs to set up product analytics, event tracking, or says 'set up analytics,' 'add tracking,' 'GA4,' 'Mixpanel,' 'PostHog,' 'Amplitude,' 'what events should we track,' 'conversion tracking,' 'funnel tracking,' or is launching a product and needs to instrument it for data collection.4---56# Analytics Setup78You are setting up product analytics that answer real business questions. Your goal is to create a tracking plan that captures meaningful user behavior without drowning in noise.910## Process1112### 1. Define Key Questions1314Before adding any tracking code, list the top 5 questions you need to answer:15161. Are users activating? (Reaching the "aha moment")172. Are users coming back? (Retention)183. Where do users drop off? (Funnel leaks)194. Which features drive engagement? (Feature adoption)205. What brings users to the product? (Attribution)2122### 2. Design the Event Taxonomy2324Use a consistent naming convention:2526```27[object]_[action]2829Examples:30- page_viewed31- signup_started32- signup_completed33- feature_used34- subscription_started35- subscription_cancelled36- error_occurred37```3839Rules:40- Past tense for completed actions (`signup_completed` not `signup`)41- Snake_case, lowercase42- Object first, then action43- Include properties for context, not in the event name4445### 3. Core Events (Every Product Needs These)4647```javascript48// Identification49analytics.identify(userId, {50 email: user.email,51 created_at: user.createdAt,52 plan: user.plan,53});5455// Page / Screen Views56analytics.page('Dashboard');5758// Activation Funnel59analytics.track('signup_started', { source: 'landing_page' });60analytics.track('signup_completed', { method: 'google_oauth' });61analytics.track('onboarding_step_completed', { step: 1, step_name: 'create_workspace' });62analytics.track('activation_completed'); // User hit the "aha moment"6364// Feature Usage65analytics.track('feature_used', {66 feature_name: 'export_csv',67 context: 'dashboard',68});6970// Revenue71analytics.track('subscription_started', {72 plan: 'pro',73 billing_cycle: 'annual',74 mrr: 29,75});76```7778### 4. Platform Selection Guide7980| Tool | Best For | Price |81|------|----------|-------|82| **PostHog** | Self-hosted, open source, full suite | Free (self-hosted) |83| **Mixpanel** | Event analytics, funnels, retention | Free up to 20M events |84| **Amplitude** | Product analytics at scale | Free up to 10M events |85| **GA4** | Marketing analytics, attribution | Free |86| **Plausible** | Privacy-friendly, simple web analytics | $9/mo |8788Recommendation for startups: **PostHog** (self-hosted) or **Mixpanel** (free tier) for product analytics + **GA4** for marketing attribution. Don't use GA4 alone — it's not built for product analytics.8990### 5. Implementation Checklist9192- [ ] Event taxonomy documented (shared spreadsheet or wiki page)93- [ ] Analytics library installed and configured94- [ ] User identification set up (anonymous → identified on signup)95- [ ] Core funnel events tracked (signup → activation → retention)96- [ ] Feature usage events tracked (top 5 features)97- [ ] Revenue events tracked (subscription lifecycle)98- [ ] Error events tracked (with error type and context)99- [ ] UTM parameters captured for attribution100- [ ] Events validated in dev before deploying to production101- [ ] Dashboard created for the 5 key questions from Step 1102103## Anti-Patterns104105- **Tracking everything** — 200 events where 20 would do. More events = more noise.106- **No naming convention** — `click_button`, `buttonClick`, `btn_clicked` for the same thing107- **Tracking PII in events** — Never include email, IP, or personal data in event properties108- **No documentation** — Events tracked but nobody knows what they mean109- **Analytics as afterthought** — Added after launch, missing the most valuable early data