product-analytics

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Product Analytics

产品分析

Core Principles

核心原则

  • Metrics over vanity — Focus on actionable metrics tied to business outcomes
  • Data-driven decisions — Hypothesize, measure, learn, iterate
  • User-centric measurement — Track behavior, not just pageviews
  • Statistical rigor — Understand significance, avoid false positives
  • Privacy-first — Respect user data, comply with GDPR/CCPA
  • North Star focus — Align all teams around one key metric

  • 重实效指标,轻虚荣指标 — 聚焦与业务成果挂钩的可落地指标
  • 数据驱动决策 — 提出假设、衡量结果、总结学习、迭代优化
  • 以用户为中心的衡量 — 追踪用户行为,而非仅页面浏览量
  • 统计严谨性 — 理解统计显著性,避免假阳性结果
  • 隐私优先 — 尊重用户数据,合规GDPR/CCPA
  • 北极星指标聚焦 — 让所有团队围绕一个核心指标对齐

Hard Rules (Must Follow)

硬性规则(必须遵守)

These rules are mandatory. Violating them means the skill is not working correctly.
这些规则为强制性要求。违反规则意味着该技能未正常发挥作用。

No PII in Events

事件中禁止包含个人可识别信息(PII)

Events must NEVER contain personally identifiable information.
javascript
// ❌ FORBIDDEN: PII in event properties
track('user_signed_up', {
  email: 'user@example.com',     // PII!
  name: 'John Doe',              // PII!
  phone: '+1234567890',          // PII!
  ip_address: '192.168.1.1',     // PII!
  credit_card: '4111...',        // NEVER!
});

// ✅ REQUIRED: Anonymized/hashed identifiers only
track('user_signed_up', {
  user_id: hash('user@example.com'),  // Hashed
  plan: 'pro',
  source: 'organic',
  country: 'US',                       // Broad location OK
});

// Masking utilities
const maskEmail = (email) => {
  const [name, domain] = email.split('@');
  return `${name[0]}***@${domain}`;
};
事件中绝对不能包含个人可识别信息。
javascript
// ❌ FORBIDDEN: PII in event properties
track('user_signed_up', {
  email: 'user@example.com',     // PII!
  name: 'John Doe',              // PII!
  phone: '+1234567890',          // PII!
  ip_address: '192.168.1.1',     // PII!
  credit_card: '4111...',        // NEVER!
});

// ✅ REQUIRED: Anonymized/hashed identifiers only
track('user_signed_up', {
  user_id: hash('user@example.com'),  // Hashed
  plan: 'pro',
  source: 'organic',
  country: 'US',                       // Broad location OK
});

// Masking utilities
const maskEmail = (email) => {
  const [name, domain] = email.split('@');
  return `${name[0]}***@${domain}`;
};

Object_Action Event Naming

事件命名遵循Object_Action格式

All event names must follow the object_action snake_case format.
javascript
// ❌ FORBIDDEN: Inconsistent naming
track('signup');                    // No object
track('newProject');                // camelCase
track('Upload File');               // Spaces and PascalCase
track('user-created');              // kebab-case
track('BUTTON_CLICKED');            // SCREAMING_CASE

// ✅ REQUIRED: object_action snake_case
track('user_signed_up');
track('project_created');
track('file_uploaded');
track('payment_completed');
track('checkout_started');
所有事件名称必须遵循object_action蛇形命名法。
javascript
// ❌ FORBIDDEN: Inconsistent naming
track('signup');                    // No object
track('newProject');                // camelCase
track('Upload File');               // Spaces and PascalCase
track('user-created');              // kebab-case
track('BUTTON_CLICKED');            // SCREAMING_CASE

// ✅ REQUIRED: object_action snake_case
track('user_signed_up');
track('project_created');
track('file_uploaded');
track('payment_completed');
track('checkout_started');

Actionable Metrics Only

仅追踪可落地指标

Track metrics that drive decisions, not vanity metrics.
javascript
// ❌ FORBIDDEN: Vanity metrics without context
track('page_viewed');               // No insight
track('button_clicked');            // Too generic
track('app_opened');                // Doesn't indicate value

// ✅ REQUIRED: Actionable metrics tied to outcomes
track('feature_activated', {
  feature: 'dark_mode',
  time_to_activation_hours: 2.5,
  user_segment: 'power_user',
});

track('checkout_completed', {
  order_value: 99.99,
  items_count: 3,
  payment_method: 'credit_card',
  coupon_applied: true,
});
追踪能驱动决策的指标,而非虚荣指标。
javascript
// ❌ FORBIDDEN: Vanity metrics without context
track('page_viewed');               // No insight
track('button_clicked');            // Too generic
track('app_opened');                // Doesn't indicate value

// ✅ REQUIRED: Actionable metrics tied to outcomes
track('feature_activated', {
  feature: 'dark_mode',
  time_to_activation_hours: 2.5,
  user_segment: 'power_user',
});

track('checkout_completed', {
  order_value: 99.99,
  items_count: 3,
  payment_method: 'credit_card',
  coupon_applied: true,
});

Statistical Rigor for Experiments

实验需具备统计严谨性

A/B tests must have proper sample size and significance thresholds.
javascript
// ❌ FORBIDDEN: Drawing conclusions too early
// "After 100 users, variant B has 5% higher conversion!"
// This is not statistically significant.

// ✅ REQUIRED: Proper experiment setup
const experimentConfig = {
  name: 'new_checkout_flow',
  hypothesis: 'New flow increases conversion by 10%',

  // Statistical requirements
  significance_level: 0.05,      // 95% confidence
  power: 0.80,                   // 80% power
  minimum_detectable_effect: 0.10, // 10% lift

  // Calculated sample size
  sample_size_per_variant: 3842,

  // Guardrails
  max_duration_days: 14,
  stop_if_degradation: -0.05,    // Stop if 5% worse
};

A/B测试必须具备合适的样本量和显著性阈值。
javascript
// ❌ FORBIDDEN: Drawing conclusions too early
// "After 100 users, variant B has 5% higher conversion!"
// This is not statistically significant.

// ✅ REQUIRED: Proper experiment setup
const experimentConfig = {
  name: 'new_checkout_flow',
  hypothesis: 'New flow increases conversion by 10%',

  // Statistical requirements
  significance_level: 0.05,      // 95% confidence
  power: 0.80,                   // 80% power
  minimum_detectable_effect: 0.10, // 10% lift

  // Calculated sample size
  sample_size_per_variant: 3842,

  // Guardrails
  max_duration_days: 14,
  stop_if_degradation: -0.05,    // Stop if 5% worse
};

Quick Reference

快速参考

When to Use What

场景对应工具/框架

ScenarioFramework/ToolKey Metric
Overall product healthNorth Star MetricTime spent listening (Spotify), Nights booked (Airbnb)
Growth optimizationAARRR (Pirate Metrics)Conversion rates per stage
Feature validationA/B TestingStatistical significance (p < 0.05)
User engagementCohort AnalysisDay 1/7/30 retention rates
Conversion optimizationFunnel AnalysisDrop-off rates per step
Feature impactAttribution ModelingMulti-touch attribution
Experiment successStatistical TestingPower, significance, effect size

场景框架/工具核心指标
整体产品健康度北极星指标(North Star Metric)听歌时长(Spotify)、预订晚数(Airbnb)
增长优化AARRR(海盗指标)各阶段转化率
功能验证A/B测试统计显著性(p < 0.05)
用户参与度同期群分析第1/7/30日留存率
转化优化漏斗分析各步骤流失率
功能影响归因建模多触点归因
实验成功判定统计测试检验效能、显著性、效应量

North Star Metric

北极星指标(North Star Metric)

Definition

定义

A North Star Metric is the one metric that best captures the core value your product delivers to customers. When this metric grows sustainably, your business succeeds.
北极星指标是最能体现产品为客户提供核心价值的单一指标。当该指标持续增长时,业务就能取得成功。

Characteristics of Good NSMs

优质北极星指标的特征

✓ Captures product value delivery
✓ Correlates with revenue/growth
✓ Measurable and trackable
✓ Movable by product/engineering
✓ Understandable by entire org
✓ Leading (not lagging) indicator
✓ 体现产品价值交付
✓ 与收入/增长相关
✓ 可衡量、可追踪
✓ 可通过产品/工程手段影响
✓ 全组织可理解
✓ 领先指标(而非滞后指标)

Examples by Company

各公司示例

CompanyNorth Star MetricWhy It Works
SpotifyTime Spent ListeningCore value = music enjoyment
AirbnbNights BookedRevenue driver + value delivered
SlackDaily Active TeamsEngagement = product stickiness
FacebookMonthly Active UsersNetwork effect foundation
AmplitudeWeekly Learning UsersValue = analytics insights
DropboxActive Users Sharing FilesCore product behavior
公司北极星指标合理性
Spotify听歌时长核心价值 = 音乐享受
Airbnb预订晚数收入驱动因素 + 价值交付体现
Slack日活跃团队数参与度 = 产品粘性
Facebook月活跃用户数网络效应基础
Amplitude周学习用户数价值 = 分析洞察
Dropbox分享文件的活跃用户数核心产品行为

NSM Framework

北极星指标框架

North Star Metric
┌──────┴──────┬──────────┬──────────┐
│             │          │          │
Input 1    Input 2   Input 3   Input 4
(Supporting metrics that drive NSM)

Example: Spotify
NSM: Time Spent Listening
├── Daily Active Users
├── Playlists Created
├── Songs Added to Library
└── Share/Social Actions
北极星指标
┌──────┴──────┬──────────┬──────────┐
│             │          │          │
输入1    输入2   输入3   输入4
(驱动北极星指标的支撑性指标)

示例:Spotify
北极星指标:听歌时长
├── 日活跃用户数
├── 创建的播放列表数
├── 添加到库的歌曲数
└── 分享/社交行为

How to Define Your NSM

如何定义你的北极星指标

  1. Identify core value proposition
    • What job does your product do for users?
    • When do users get "aha!" moment?
  2. Find the metric that represents this value
    • Transaction completed? (e.g., Nights Booked)
    • Time engaged? (e.g., Time Listening)
    • Content created? (e.g., Messages Sent)
  3. Validate it correlates with business success
    • Does NSM increase → revenue increases?
    • Can product changes move this metric?
  4. Define supporting input metrics
    • What user behaviors drive NSM?
    • Break into 3-5 key inputs

  1. 明确核心价值主张
    • 你的产品为用户解决什么核心问题?
    • 用户何时会产生"恍然大悟!"的时刻?
  2. 找到体现该价值的指标
    • 交易完成?(如:预订晚数)
    • 参与时长?(如:听歌时长)
    • 内容创建?(如:发送消息数)
  3. 验证其与业务成功的相关性
    • 北极星指标增长 → 收入增长吗?
    • 产品变更能否影响该指标?
  4. 定义支撑性输入指标
    • 哪些用户行为驱动北极星指标?
    • 拆解为3-5个关键输入指标

AARRR Framework (Pirate Metrics)

AARRR框架(海盗指标)

Overview

概述

The AARRR framework tracks the customer lifecycle across five stages:
ACQUISITION → ACTIVATION → RETENTION → REFERRAL → REVENUE
AARRR框架追踪客户生命周期的五个阶段:
获取(ACQUISITION)→ 激活(ACTIVATION)→ 留存(RETENTION)→ 推荐(REFERRAL)→ 收入(REVENUE)

Stage Definitions

阶段定义

1. Acquisition

1. 获取(Acquisition)

When users discover your product
Key Questions:
  • Where do users come from?
  • Which channels have best quality users?
  • What's the cost per acquisition (CPA)?
Metrics:
• Website visitors
• App installs
• Sign-ups per channel
• Cost per acquisition (CPA)
• Channel conversion rates
Example Events:
javascript
// Landing page view
track('page_viewed', {
  page: 'landing',
  utm_source: 'google',
  utm_medium: 'cpc',
  utm_campaign: 'brand_search'
});

// Sign-up started
track('signup_started', {
  source: 'homepage_cta'
});
用户发现产品的阶段
关键问题:
  • 用户从何处而来?
  • 哪些渠道的用户质量最高?
  • 客户获取成本(CPA)是多少?
指标:
• 网站访客数
• 应用安装量
• 各渠道注册数
• 客户获取成本(CPA)
• 渠道转化率
示例事件:
javascript
// Landing page view
track('page_viewed', {
  page: 'landing',
  utm_source: 'google',
  utm_medium: 'cpc',
  utm_campaign: 'brand_search'
});

// Sign-up started
track('signup_started', {
  source: 'homepage_cta'
});

2. Activation

2. 激活(Activation)

When users experience core product value
Key Questions:
  • What's the "aha!" moment?
  • How long to first value?
  • What % reach activation?
Metrics:
• Time to first action
• Activation rate (% completing key action)
• Setup completion rate
• Feature adoption rate
Example "Aha!" Moments:
Slack:     Send 2,000 messages in team
Twitter:   Follow 30 users
Dropbox:   Upload first file
LinkedIn:  Connect with 5 people
Example Events:
javascript
// Activation milestone
track('activated', {
  user_id: 'usr_123',
  activation_action: 'first_project_created',
  time_to_activation_hours: 2.5
});
用户体验到产品核心价值的阶段
关键问题:
  • "恍然大悟!"的时刻是什么?
  • 首次体验价值需要多长时间?
  • 多大比例的用户能达到激活状态?
指标:
• 首次行动时长
• 激活率(完成关键行动的用户占比)
• 设置完成率
• 功能采用率
示例"恍然大悟!"时刻:
Slack:     团队内发送2000条消息
Twitter:   关注30个用户
Dropbox:   上传第一个文件
LinkedIn:  连接5个联系人
示例事件:
javascript
// Activation milestone
track('activated', {
  user_id: 'usr_123',
  activation_action: 'first_project_created',
  time_to_activation_hours: 2.5
});

3. Retention

3. 留存(Retention)

When users keep coming back
Key Questions:
  • What's Day 1/7/30 retention?
  • Which cohorts retain best?
  • What drives churn?
Metrics:
• Day 1/7/30 retention rate
• Weekly/Monthly active users (WAU/MAU)
• Churn rate
• Usage frequency
• Feature stickiness (DAU/MAU)
Retention Calculation:
Day X Retention = Users returning on Day X / Total users in cohort

Example:
Cohort: 1000 users signed up Jan 1
Day 7: 300 returned
Day 7 Retention = 300/1000 = 30%
Example Events:
javascript
// Daily engagement
track('session_started', {
  user_id: 'usr_123',
  session_count: 42,
  days_since_signup: 15
});
用户持续回访的阶段
关键问题:
  • 第1/7/30日留存率是多少?
  • 哪些同期群的留存表现最好?
  • 什么因素导致用户流失?
指标:
• 第1/7/30日留存率
• 周/月活跃用户数(WAU/MAU)
• 用户流失率
• 使用频率
• 功能粘性(DAU/MAU)
留存率计算:
第X日留存率 = 第X日回访用户数 / 同期群总用户数

示例:
同期群:1月1日注册的1000名用户
第7日:300人回访
第7日留存率 = 300/1000 = 30%
示例事件:
javascript
// Daily engagement
track('session_started', {
  user_id: 'usr_123',
  session_count: 42,
  days_since_signup: 15
});

4. Referral

4. 推荐(Referral)

When users recommend your product
Key Questions:
  • What's the viral coefficient (K-factor)?
  • Which users refer most?
  • What referral incentives work?
Metrics:
• Viral coefficient (K-factor)
• Referral rate (% users referring)
• Invites sent per user
• Invite conversion rate
• Net Promoter Score (NPS)
Viral Coefficient:
K = (% users who refer) × (avg invites per user) × (invite conversion rate)

Example:
K = 0.20 × 5 × 0.30 = 0.30

K > 1: Viral growth (each user brings >1 new user)
K < 1: Need paid acquisition
Example Events:
javascript
// Referral actions
track('invite_sent', {
  user_id: 'usr_123',
  channel: 'email',
  recipients: 3
});

track('referral_converted', {
  referrer_id: 'usr_123',
  new_user_id: 'usr_456',
  channel: 'email'
});
用户推荐产品的阶段
关键问题:
  • 病毒系数(K-factor)是多少?
  • 哪些用户推荐意愿最强?
  • 哪种推荐激励有效?
指标:
• 病毒系数(K-factor)
• 推荐率(推荐用户占比)
• 人均发送邀请数
• 邀请转化率
• 净推荐值(NPS)
病毒系数计算:
K = (推荐用户占比) × (人均邀请数) × (邀请转化率)

示例:
K = 0.20 × 5 × 0.30 = 0.30

K > 1: 病毒式增长(每个用户带来超过1个新用户)
K < 1: 需要付费获取用户
示例事件:
javascript
// Referral actions
track('invite_sent', {
  user_id: 'usr_123',
  channel: 'email',
  recipients: 3
});

track('referral_converted', {
  referrer_id: 'usr_123',
  new_user_id: 'usr_456',
  channel: 'email'
});

5. Revenue

5. 收入(Revenue)

When users generate business value
Key Questions:
  • What's customer lifetime value (LTV)?
  • What's LTV:CAC ratio?
  • Which segments monetize best?
Metrics:
• Monthly Recurring Revenue (MRR)
• Average Revenue Per User (ARPU)
• Customer Lifetime Value (LTV)
• LTV:CAC ratio
• Conversion to paid
• Revenue churn
LTV Calculation:
LTV = ARPU × Gross Margin / Churn Rate

Example:
ARPU: $50/month
Gross Margin: 80%
Churn: 5%/month

LTV = $50 × 0.80 / 0.05 = $800

Healthy LTV:CAC ratio: 3:1 or higher
Example Events:
javascript
// Revenue events
track('subscription_started', {
  user_id: 'usr_123',
  plan: 'pro',
  mrr: 29.99,
  billing_cycle: 'monthly'
});

track('upgrade_completed', {
  user_id: 'usr_123',
  from_plan: 'basic',
  to_plan: 'pro',
  mrr_change: 20.00
});
用户为业务创造价值的阶段
关键问题:
  • 客户终身价值(LTV)是多少?
  • LTV:CAC比值是多少?
  • 哪些细分群体变现能力最强?
指标:
• 月度经常性收入(MRR)
• 每用户平均收入(ARPU)
• 客户终身价值(LTV)
• LTV:CAC比值
• 付费转化率
• 收入流失率
LTV计算:
LTV = ARPU × 毛利率 / 流失率

示例:
ARPU: 50美元/月
毛利率: 80%
流失率: 5%/月

LTV = 50 × 0.80 / 0.05 = 800美元

健康的LTV:CAC比值:3:1或更高
示例事件:
javascript
// Revenue events
track('subscription_started', {
  user_id: 'usr_123',
  plan: 'pro',
  mrr: 29.99,
  billing_cycle: 'monthly'
});

track('upgrade_completed', {
  user_id: 'usr_123',
  from_plan: 'basic',
  to_plan: 'pro',
  mrr_change: 20.00
});

AARRR Metrics Dashboard

AARRR指标仪表盘示例

markdown
undefined
markdown
undefined

Acquisition

获取

  • Total visitors: 50,000
  • Sign-ups: 2,500 (5% conversion)
  • Top channels: Organic (40%), Paid (30%), Referral (20%)
  • 总访客数: 50,000
  • 注册数: 2,500(5%转化率)
  • 顶级渠道: 自然流量(40%)、付费流量(30%)、推荐流量(20%)

Activation

激活

  • Activated users: 1,750 (70% of sign-ups)
  • Time to activation: 3.2 hours (median)
  • Activation funnel drop-off: 30% at setup step 2
  • 激活用户数: 1,750(注册用户的70%)
  • 激活时长: 3.2小时(中位数)
  • 激活漏斗流失率: 步骤2流失30%

Retention

留存

  • Day 1: 60%
  • Day 7: 35%
  • Day 30: 20%
  • Churn: 5%/month
  • 第1日: 60%
  • 第7日: 35%
  • 第30日: 20%
  • 月流失率: 5%

Referral

推荐

  • K-factor: 0.4
  • Users referring: 15%
  • Invites per user: 4.2
  • Invite conversion: 25%
  • K系数: 0.4
  • 推荐用户占比: 15%
  • 人均邀请数: 4.2
  • 邀请转化率: 25%

Revenue

收入

  • MRR: $125,000
  • ARPU: $50
  • LTV: $800
  • LTV:CAC: 4:1
  • Conversion to paid: 25%

---
  • MRR: 125,000美元
  • ARPU: 50美元
  • LTV: 800美元
  • LTV:CAC: 4:1
  • 付费转化率: 25%

---

Key Metrics & Formulas

核心指标与公式

Engagement Metrics

参与度指标

Daily Active Users (DAU)
= Unique users performing key action per day

Monthly Active Users (MAU)
= Unique users performing key action per month

Stickiness = DAU / MAU × 100%
• 20%+ = Good (users engage 6+ days/month)
• 10-20% = Average
• <10% = Low engagement

Session Duration
= Average time between session start and end

Session Frequency
= Average sessions per user per time period
日活跃用户数(DAU)
= 每日执行关键行动的独立用户数

月活跃用户数(MAU)
= 每月执行关键行动的独立用户数

粘性 = DAU / MAU × 100%
• 20%+ = 良好(用户每月参与6天以上)
• 10-20% = 一般
• <10% = 参与度低

会话时长
= 会话开始到结束的平均时长

会话频率
= 每个用户在统计周期内的平均会话数

Retention Metrics

留存指标

Retention Rate (Classic)
= Users active in Week N / Users in original cohort

Retention Rate (Bracket)
= Users active in Week N / Users active in Week 0

Churn Rate
= (Users at start - Users at end) / Users at start

Quick Ratio (Growth Health)
= (New MRR + Expansion MRR) / (Churned MRR + Contraction MRR)
• >4 = Excellent growth
• 2-4 = Good
• <1 = Shrinking
经典留存率
= 第N周活跃用户数 / 同期群初始用户数

区间留存率
= 第N周活跃用户数 / 第0周活跃用户数

流失率
= (期初用户数 - 期末用户数) / 期初用户数

快速比值(增长健康度)
= (新增MRR + 拓展MRR) / (流失MRR + 收缩MRR)
• >4 = 增长极佳
• 2-4 = 良好
• <1 = 业务萎缩

Conversion Metrics

转化指标

Conversion Rate
= (Conversions / Total visitors) × 100%

Funnel Conversion
= (Users completing final step / Users entering funnel) × 100%

Time to Convert
= Median time from first touch to conversion
转化率
= (转化数 / 总访客数) × 100%

漏斗转化率
= (完成最终步骤用户数 / 进入漏斗用户数) × 100%

转化时长
= 从首次触达到转化的中位数时长

Revenue Metrics

收入指标

Monthly Recurring Revenue (MRR)
= Sum of all monthly subscription values

Annual Recurring Revenue (ARR)
= MRR × 12

Average Revenue Per User (ARPU)
= Total revenue / Number of users

Customer Lifetime Value (LTV)
= ARPU × Average customer lifetime (months)
OR
= ARPU × Gross Margin % / Monthly Churn Rate

Customer Acquisition Cost (CAC)
= Total sales & marketing spend / New customers acquired

LTV:CAC Ratio
= LTV / CAC
• >3:1 = Healthy
• 1:1 = Unsustainable

Payback Period
= CAC / (ARPU × Gross Margin %)
• <12 months = Good
• 12-18 months = Acceptable
• >18 months = Concerning

月度经常性收入(MRR)
= 所有月度订阅金额之和

年度经常性收入(ARR)
= MRR × 12

每用户平均收入(ARPU)
= 总收入 / 用户数

客户终身价值(LTV)
= ARPU × 平均客户生命周期(月)
= ARPU × 毛利率 / 月流失率

客户获取成本(CAC)
= 总销售与营销支出 / 新增客户数

LTV:CAC比值
= LTV / CAC
• >3:1 = 健康
• 1:1 = 不可持续

回收期
= CAC / (ARPU × 毛利率)
• <12个月 = 良好
• 12-18个月 = 可接受
• >18个月 = 需关注

Event Tracking Best Practices

事件追踪最佳实践

Event Naming Convention

事件命名规范

Object + Action pattern (recommended)

✓ user_signed_up
✓ project_created
✓ file_uploaded
✓ payment_completed

✗ signup (unclear)
✗ new_project (inconsistent)
✗ Upload File (inconsistent case)
对象+动作模式(推荐)

✓ user_signed_up
✓ project_created
✓ file_uploaded
✓ payment_completed

✗ signup(表述模糊)
✗ new_project(格式不一致)
✗ Upload File(大小写与空格不一致)

Event Properties Structure

事件属性结构

javascript
// Standard event structure
{
  event: "checkout_completed",        // Event name
  timestamp: "2025-12-16T10:30:00Z",  // When
  user_id: "usr_123",                 // Who
  session_id: "ses_abc",              // Session context
  properties: {                       // Event-specific data
    order_id: "ord_789",
    total_amount: 99.99,
    currency: "USD",
    item_count: 3,
    payment_method: "credit_card",
    coupon_used: true,
    discount_amount: 10.00
  },
  context: {                          // Global context
    app_version: "2.4.1",
    platform: "web",
    user_agent: "...",
    ip: "192.168.1.1",
    locale: "en-US"
  }
}
javascript
// Standard event structure
{
  event: "checkout_completed",        // Event name
  timestamp: "2025-12-16T10:30:00Z",  // When
  user_id: "usr_123",                 // Who
  session_id: "ses_abc",              // Session context
  properties: {                       // Event-specific data
    order_id: "ord_789",
    total_amount: 99.99,
    currency: "USD",
    item_count: 3,
    payment_method: "credit_card",
    coupon_used: true,
    discount_amount: 10.00
  },
  context: {                          // Global context
    app_version: "2.4.1",
    platform: "web",
    user_agent: "...",
    ip: "192.168.1.1",
    locale: "en-US"
  }
}

Critical Events to Track

需追踪的关键事件

markdown
undefined
markdown
undefined

User Lifecycle

用户生命周期

  • user_signed_up
  • user_activated (first key action)
  • user_onboarded (completed setup)
  • user_upgraded (plan change)
  • user_churned (canceled/inactive)
  • user_signed_up
  • user_activated(首次关键行动)
  • user_onboarded(完成设置)
  • user_upgraded(套餐变更)
  • user_churned(取消/不活跃)

Feature Usage

功能使用

  • feature_viewed
  • feature_used
  • feature_completed
  • feature_viewed
  • feature_used
  • feature_completed

Commerce

电商

  • product_viewed
  • product_added_to_cart
  • checkout_started
  • payment_completed
  • order_fulfilled
  • product_viewed
  • product_added_to_cart
  • checkout_started
  • payment_completed
  • order_fulfilled

Engagement

参与度

  • session_started
  • session_ended
  • page_viewed
  • search_performed
  • content_shared
  • session_started
  • session_ended
  • page_viewed
  • search_performed
  • content_shared

Errors

错误

  • error_occurred
  • payment_failed
  • api_error
undefined
  • error_occurred
  • payment_failed
  • api_error
undefined

Privacy & Compliance

隐私与合规

javascript
// ✓ GOOD: No PII in events
track('user_signed_up', {
  user_id: hashUserId('user@example.com'),  // Hashed
  plan: 'pro',
  source: 'organic'
});

// ✗ BAD: Contains PII
track('user_signed_up', {
  email: 'user@example.com',  // PII!
  password: '...',            // Never log!
  credit_card: '...'          // Never log!
});

// Masking strategies
const maskEmail = (email) => {
  const [name, domain] = email.split('@');
  return `${name[0]}***@${domain}`;
};

const maskCard = (card) => `****${card.slice(-4)}`;

javascript
// ✓ GOOD: No PII in events
track('user_signed_up', {
  user_id: hashUserId('user@example.com'),  // Hashed
  plan: 'pro',
  source: 'organic'
});

// ✗ BAD: Contains PII
track('user_signed_up', {
  email: 'user@example.com',  // PII!
  password: '...',            // Never log!
  credit_card: '...'          // Never log!
});

// Masking strategies
const maskEmail = (email) => {
  const [name, domain] = email.split('@');
  return `${name[0]}***@${domain}`;
};

const maskCard = (card) => `****${card.slice(-4)}`;

See Also

相关参考

  • reference/event-tracking.md — Event tracking and data modeling guide
  • reference/metrics-framework.md — North Star, AARRR, key metrics deep dive
  • reference/experimentation.md — A/B testing and statistical best practices
  • reference/retention.md — Cohort analysis and retention strategies
  • templates/tracking-plan.md — Event tracking plan template
  • reference/event-tracking.md — 事件追踪与数据建模指南
  • reference/metrics-framework.md — 北极星指标、AARRR、核心指标深度解析
  • reference/experimentation.md — A/B测试与统计最佳实践
  • reference/retention.md — 同期群分析与留存策略
  • templates/tracking-plan.md — 事件追踪计划模板