analytics

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Analytics Tracking

Analytics 跟踪

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:
  1. Business Context - What decisions will this data inform? What are key conversions?
  2. Current State - What tracking exists? What tools are in use?
  3. Technical Context - What's the tech stack? Any privacy/compliance requirements?

首先检查产品营销背景: 如果存在
.agents/product-marketing.md
(或旧版设置中的
.claude/product-marketing.md
,或遗留文件名
product-marketing-context.md
),请先阅读该文件再提问。利用其中的背景信息,仅询问未涵盖或与本次任务相关的特定信息。
在实施跟踪之前,需了解:
  1. 业务背景 - 这些数据将为哪些决策提供依据?核心转化目标是什么?
  2. 当前状态 - 已存在哪些跟踪机制?正在使用哪些工具?
  3. 技术背景 - 技术栈是什么?有哪些隐私/合规要求?

Core Principles

核心原则

1. Track for Decisions, Not Data

1. 为决策而非数据跟踪

  • Every event should inform a decision
  • Avoid vanity metrics
  • Quality > quantity of events
  • 每个事件都应服务于决策制定
  • 避免虚荣指标
  • 事件质量 > 事件数量

2. Start with the Questions

2. 从问题出发

  • 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

3. 命名保持一致

  • Naming conventions matter
  • Establish patterns before implementing
  • Document everything
  • 命名规范至关重要
  • 实施前先确立命名模式
  • 做好所有文档记录

4. Maintain Data Quality

4. 维护数据质量

  • Validate implementation
  • Monitor for issues
  • Clean data > more data

  • 验证实施效果
  • 监控问题
  • 干净的数据 > 更多的数据

Tracking Plan Framework

跟踪计划框架

Structure

结构

Event Name | Category | Properties | Trigger | Notes
---------- | -------- | ---------- | ------- | -----
Event Name | Category | Properties | Trigger | Notes
---------- | -------- | ---------- | ------- | -----

Event Types

事件类型

TypeExamples
PageviewsAutomatic, enhanced with metadata
User ActionsButton clicks, form submissions, feature usage
System EventsSignup completed, purchase, subscription changed
Custom ConversionsGoal completions, funnel stages
For comprehensive event lists: See references/event-library.md

类型示例
页面浏览量自动采集,附加元数据增强
用户操作按钮点击、表单提交、功能使用
系统事件注册完成、购买、订阅变更
自定义转化目标完成、漏斗阶段
完整事件列表参考:请查看references/event-library.md

Event Naming Conventions

事件命名规范

Recommended Format: Object-Action

推荐格式:对象-动作

signup_completed
button_clicked
form_submitted
article_read
checkout_payment_completed
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

  • 使用小写字母加下划线
  • 具体明确:
    cta_hero_clicked
    优于
    button_clicked
  • 将上下文信息放在属性中,而非事件名称里
  • 避免空格和特殊字符
  • 记录命名决策

Essential Events

关键事件

Marketing Site

营销网站

EventProperties
cta_clickedbutton_text, location
form_submittedform_type
signup_completedmethod, source
demo_requested-
事件属性
cta_clickedbutton_text, location
form_submittedform_type
signup_completedmethod, source
demo_requested-

Product/App

产品/应用

EventProperties
onboarding_step_completedstep_number, step_name
feature_usedfeature_name
purchase_completedplan, value
subscription_cancelledreason
For full event library by business type: See references/event-library.md

事件属性
onboarding_step_completedstep_number, step_name
feature_usedfeature_name
purchase_completedplan, value
subscription_cancelledreason
按业务类型划分的完整事件库:请查看references/event-library.md

Event Properties

事件属性

Standard Properties

标准属性

CategoryProperties
Pagepage_title, page_location, page_referrer
Useruser_id, user_type, account_id, plan_type
Campaignsource, medium, campaign, content, term
Productproduct_id, product_name, category, price
类别属性
页面page_title, page_location, page_referrer
用户user_id, user_type, account_id, plan_type
营销活动source, medium, campaign, content, term
产品product_id, product_name, category, price

Best Practices

最佳实践

  • Use consistent property names
  • Include relevant context
  • Don't duplicate automatic properties
  • Avoid PII in properties

  • 使用一致的属性名称
  • 包含相关上下文信息
  • 不要重复自动采集的属性
  • 属性中避免包含个人身份信息(PII)

GA4 Implementation

GA4 实施

Quick Setup

快速设置

  1. Create GA4 property and data stream
  2. Install gtag.js or GTM
  3. Enable enhanced measurement
  4. Configure custom events
  5. Mark conversions in Admin
  1. 创建GA4媒体资源和数据流
  2. 安装gtag.js或GTM
  3. 启用增强型测量
  4. 配置自定义事件
  5. 在管理后台标记转化

Custom Event Example

自定义事件示例

javascript
gtag('event', 'signup_completed', {
  'method': 'email',
  'plan': 'free'
});
For detailed GA4 implementation: See references/ga4-implementation.md

javascript
gtag('event', 'signup_completed', {
  'method': 'email',
  'plan': 'free'
});
GA4详细实施指南:请查看references/ga4-implementation.md

Google Tag Manager

Google Tag Manager(GTM)

Container Structure

容器结构

ComponentPurpose
TagsCode that executes (GA4, pixels)
TriggersWhen tags fire (page view, click)
VariablesDynamic values (click text, data layer)
组件用途
标签(Tags)执行代码(GA4、像素代码等)
触发器(Triggers)标签触发时机(页面浏览、点击等)
变量(Variables)动态值(点击文本、data layer等)

Data Layer Pattern

数据层(Data Layer)模式

javascript
dataLayer.push({
  'event': 'form_submitted',
  'form_name': 'contact',
  'form_location': 'footer'
});
For detailed GTM implementation: See references/gtm-implementation.md

javascript
dataLayer.push({
  'event': 'form_submitted',
  'form_name': 'contact',
  'form_location': 'footer'
});
GTM详细实施指南:请查看references/gtm-implementation.md

UTM Parameter Strategy

UTM 参数策略

Standard Parameters

标准参数

ParameterPurposeExample
utm_sourceTraffic sourcegoogle, newsletter
utm_mediumMarketing mediumcpc, email, social
utm_campaignCampaign namespring_sale
utm_contentDifferentiate versionshero_cta
utm_termPaid search keywordsrunning+shoes
参数用途示例
utm_source流量来源google, newsletter
utm_medium营销渠道cpc, email, social
utm_campaign营销活动名称spring_sale
utm_content区分版本hero_cta
utm_term付费搜索关键词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

  • 全部使用小写
  • 统一使用下划线或连字符
  • 具体但简洁:
    blog_footer_cta
    ,而非
    cta1
  • 在电子表格中记录所有UTM参数

Debugging and Validation

调试与验证

Testing Tools

测试工具

ToolUse For
GA4 DebugViewReal-time event monitoring
GTM Preview ModeTest triggers before publish
Browser ExtensionsTag Assistant, dataLayer Inspector
工具用途
GA4 DebugView实时事件监控
GTM预览模式发布前测试触发器
浏览器扩展程序Tag Assistant、dataLayer Inspector

Validation Checklist

验证清单

  • Events firing on correct triggers
  • Property values populating correctly
  • No duplicate events
  • Works across browsers and mobile
  • Conversions recorded correctly
  • No PII leaking
  • 事件在正确的触发器下触发
  • 属性值正确填充
  • 无重复事件
  • 在各浏览器和移动端均可正常运行
  • 转化记录正确
  • 无个人身份信息(PII)泄露

Common Issues

常见问题

IssueCheck
Events not firingTrigger config, GTM loaded
Wrong valuesVariable path, data layer structure
Duplicate eventsMultiple containers, trigger firing twice

问题检查项
事件未触发触发器配置、GTM是否加载
值不正确变量路径、数据层结构
重复事件多个容器、触发器触发两次

Privacy and Compliance

隐私与合规

Considerations

注意事项

  • Cookie consent required in EU/UK/CA
  • No PII in analytics properties
  • Data retention settings
  • User deletion capabilities
  • 在欧盟/英国/加拿大需要Cookie同意
  • 分析属性中不得包含个人身份信息(PII)
  • 数据保留设置
  • 用户数据删除能力

Implementation

实施要点

  • Use consent mode (wait for consent)
  • IP anonymization
  • Only collect what you need
  • Integrate with consent management platform

  • 使用同意模式(等待用户同意)
  • IP匿名化
  • 仅收集所需数据
  • 集成同意管理平台

Output Format

输出格式

Tracking Plan Document

跟踪计划文档

markdown
undefined
markdown
undefined

[Site/Product] Tracking Plan

[网站/产品] 跟踪计划

Overview

概述

  • Tools: GA4, GTM
  • Last updated: [Date]
  • 工具:GA4, GTM
  • 最后更新:[日期]

Events

事件

Event NameDescriptionPropertiesTrigger
signup_completedUser completes signupmethod, planSuccess page
Event NameDescriptionPropertiesTrigger
signup_completed用户完成注册method, plan成功页面

Custom Dimensions

自定义维度

NameScopeParameter
user_typeUseruser_type
名称范围参数
user_type用户user_type

Conversions

转化

ConversionEventCounting
Signupsignup_completedOnce per session

---
转化目标事件计数方式
注册signup_completed每会话一次

---

Task-Specific Questions

任务特定问题

  1. What tools are you using (GA4, Mixpanel, etc.)?
  2. What key actions do you want to track?
  3. What decisions will this data inform?
  4. Who implements - dev team or marketing?
  5. Are there privacy/consent requirements?
  6. What's already tracked?

  1. 您正在使用哪些工具(GA4、Mixpanel等)?
  2. 您想要跟踪哪些关键操作?
  3. 这些数据将为哪些决策提供依据?
  4. 由谁负责实施——开发团队还是营销团队?
  5. 是否有隐私/合规要求?
  6. 目前已跟踪哪些内容?

Tool Integrations

工具集成

For implementation, see the tools registry. Key analytics tools:
ToolBest ForMCPGuide
GA4Web analytics, Google ecosystemga4.md
MixpanelProduct analytics, event tracking-mixpanel.md
AmplitudeProduct analytics, cohort analysis-amplitude.md
PostHogOpen-source analytics, session replay-posthog.md
SegmentCustomer data platform, routing-segment.md

实施相关内容请查看工具注册表。核心分析工具:
工具适用场景MCP指南
GA4网站分析、谷歌生态系统ga4.md
Mixpanel产品分析、事件跟踪-mixpanel.md
Amplitude产品分析、群组分析-amplitude.md
PostHog开源分析、会话重放-posthog.md
Segment客户数据平台、数据路由-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
  • ab-testing:用于实验跟踪
  • seo-audit:用于自然流量分析
  • cro:用于转化优化(需使用本数据)
  • revops:用于销售漏斗指标、CRM跟踪和收入归因