分析实施:GA4 配置、活动追踪、转化和数据质量。适用于跨营销渠道的网页和应用追踪。
调用时机:在首次使用时,如果有帮助,可以先用 1-2 句话说明本技能的涵盖范围和重要性,然后提供主要输出。在后续使用或用户要求跳过时,直接进入主要输出。
用户 ID
- 目的:跨设备、跨会话的用户识别
- 实施:在用户被识别时(例如登录)设置
user_id;发送到 GA4
- 收益:跨会话的准确归因;更好的受众构建
CTA 归因(文章 ROI)
追踪关键文章上的 CTA 点击以衡量内容 ROI:
| 操作 | 目的 |
|---|
| 每个 CTA 一个事件 | 例如 cta_click,包含 content_url、content_type |
| 转化 | 在 GA4 中标记为转化以进行归因 |
| 使用场景 | 比较高表现者和低表现者;优化 CTA 位置和文案 |
请参阅
seo-monitoring 了解文章数据库和基准上下文。
基础设施要求
| 组件 | 目的 |
|---|
| 数据仓库 | 集中数据;BI 报告 |
| 活动追踪 | 用户行为;漏斗映射 |
| 归因 | 广告像素;归因模型;曝光到销售的追踪 |
优化流程:干净的 UTM + 转化事件 → 归因报告 → 优化渠道组合。
范围
- GA4:网页数据流、gtag.js、配置
- 用户 ID:跨设备、跨会话识别
- CTA 归因:按文章的转化追踪,用于内容 ROI
- 事件:推荐事件和自定义事件
- 转化:关键事件、参数
- 质量:命名、测试、验证
GA4 配置
前置条件
- Google Analytics 属性和网页数据流
- 所有页面上放置 Google 标签(gtag.js)
- 衡量 ID(例如
G-XXXXXXXXXX)
增强型衡量
在管理 > 数据流 > 增强型衡量中启用,以自动追踪:
- 页面浏览、滚动、出站点击
- 网站搜索、文件下载
- 视频参与度(YouTube)
活动追踪
活动类型
| 类型 | 描述 |
|---|
| 自动收集 | page_view、first_visit、session_start |
| 增强型衡量 | scroll、click、file_download 等 |
| 推荐 | purchase、sign_up、search 等 |
| 自定义 | 业务特定操作 |
命名规范
- 长度:<= 40 个字符(GA4 硬性限制;更长的名称不会被记录)
- 格式:
snake_case,小写
- 动词优先:
download_pdf、submit_form、video_play
- 上下文:
pricing_page_scroll vs 通用 scroll
gtag.js 语法
gtag('event', '', {
: ,
// e.g. value: 99.99, currency: 'USD'
});
放置在 Google 标签代码段下方。活动在页面加载或用户操作(例如按钮点击)时触发。
推荐事件
| 事件 | 使用场景 | 关键参数 |
|---|
purchase | 电子商务 | value、currency、items |
sign_up | 注册 | method |
login | 登录 | method |
search | 网站搜索 | search_term |
view_item | 产品查看 | items |
add_to_cart | 加入购物车 | items |
自定义事件
- 聚焦于与 KPI 一致的 15-25 个有意义的事件
- 添加参数以提供上下文(例如
content_type、item_id)
- 避免追踪一切;优先质量而非数量
转化(关键事件)
- 在 GA4 管理中,将重要事件标记为转化
- 用于归因、受众和报告
- 典型事件:purchase、sign_up、lead、contact
归因和转化优化
归因模型决定转化功劳如何分配到各个触点。使用归因数据优化广告和增长渠道。
| 模型 | 使用场景 |
|---|
| 数据驱动(GA4 默认) | ML 根据实际贡献分配功劳;最适合多触点转化路径 |
| 末次点击 | 100% 分配给最终触点;简单但低估了认知/考虑阶段 |
优化流程:干净的 UTM(source、medium、campaign)+ 转化事件 → GA4 归因报告 → 按归因转化比较渠道 → 将预算重新分配给带来效果的广告/渠道。不一致的 UTM 会导致数据碎片化;多触点归因需要可靠的触点数据。
参考:UTM.io – UTMs for Marketing Attribution、GA4 – Get started with attribution
测试和验证
| 工具 | 使用场景 |
|---|
| 实时 | 查看正在触发的事件 |
| DebugView | 详细的事件/参数检查;需要调试模式 |
| GA4 调试模式 | gtag('config', 'G-XXX', { 'debug_mode': true }); 或 GTM 预览 |
输出格式
- 事件列表(名称、触发器、参数)
- 实施说明(gtag 或 GTM)
- 转化映射
- 测试清单
相关技能
- traffic-analysis:UTM、来源归因;渠道优化的归因
- ai-traffic-tracking:GA4 中的 AI 流量
- google-search-console:GSC 分析(与 GA4 关联)
- seo-monitoring:文章数据库、基准、完整 SEO 监控框架
Guides analytics implementation: GA4 setup, event tracking, conversions, and data quality. Applies to web and app tracking across marketing channels.
When invoking: On first use, if helpful, open with 1-2 sentences on what this skill covers and why it matters, then provide the main output. On subsequent use or when the user asks to skip, go directly to the main output.
User ID
- Purpose: Cross-device, cross-session user identification
- Implementation: Set
user_id when user is identified (e.g., login); send to GA4
- Benefit: Accurate attribution across sessions; better audience building
CTA Attribution (Article ROI)
Track CTA clicks on key articles to measure content ROI:
| Action | Purpose |
|---|
| Event per CTA | e.g., cta_click with content_url, content_type |
| Conversion | Mark as conversion in GA4 for attribution |
| Use | Compare high vs low performers; optimize CTA placement and copy |
See
seo-monitoring for article database and benchmark context.
Infrastructure Requirements
| Component | Purpose |
|---|
| Data warehouse | Centralized data; BI reporting |
| Event tracking | User behavior; funnel mapping |
| Attribution | Ad pixels; attribution model; impression-to-sale tracking |
Optimization flow: Clean UTM + conversion events → attribution reports → optimize channel mix.
Scope
- GA4: Web data stream, gtag.js, configuration
- User ID: Cross-device, cross-session identification
- CTA attribution: Per-article conversion tracking for content ROI
- Events: Recommended and custom events
- Conversions: Key events, parameters
- Quality: Naming, testing, validation
GA4 Setup
Prerequisites
- Google Analytics property and web data stream
- Google tag (gtag.js) on all pages
- Measurement ID (e.g.,
G-XXXXXXXXXX)
Enhanced Measurement
Enable in Admin > Data Streams > Enhanced Measurement for automatic tracking of:
- Page views, scrolls, outbound clicks
- Site search, file downloads
- Video engagement (YouTube)
Event Tracking
Event Types
| Type | Description |
|---|
| Automatically collected | page_view, first_visit, session_start |
| Enhanced measurement | scroll, click, file_download, etc. |
| Recommended | purchase, sign_up, search, etc. |
| Custom | Business-specific actions |
Naming Conventions
- Length: <=40 characters (GA4 hard limit; longer names are not logged)
- Format:
snake_case, lowercase
- Verb first:
download_pdf, submit_form, video_play
- Context:
pricing_page_scroll vs generic scroll
gtag.js Syntax
gtag('event', '', {
: ,
// e.g. value: 99.99, currency: 'USD'
});
Place below the Google tag snippet. Events fire on page load or user action (e.g., button click).
Recommended Events
| Event | Use | Key Parameters |
|---|
purchase | E-commerce | value, currency, items |
sign_up | Registration | method |
login | Login | method |
search | Site search | search_term |
view_item | Product view | items |
add_to_cart | Add to cart | items |
Custom Events
- Focus on 15-25 meaningful events aligned with KPIs
- Add parameters for context (e.g.,
content_type, item_id)
- Avoid tracking everything; prioritize quality over quantity
Conversions (Key Events)
- Mark important events as conversions in GA4 Admin
- Use for attribution, audiences, and reporting
- Typical: purchase, sign_up, lead, contact
Attribution & Conversion Optimization
Attribution models determine how conversion credit is assigned across touchpoints. Use attribution data to optimize ads and growth channels.
| Model | Use |
|---|
| Data-driven (GA4 default) | ML assigns credit by actual contribution; best for multi-touch journeys |
| Last-click | 100% to final touchpoint; simple but undervalues awareness/consideration |
Optimization flow: Clean UTM (source, medium, campaign) + conversion events → GA4 attribution reports → compare channels by attributed conversions → reallocate budget to ads/channels that drive results. Inconsistent UTM fragments data; multi-touch attribution requires reliable touchpoint data.
Reference: UTM.io – UTMs for Marketing Attribution, GA4 – Get started with attribution
Testing & Validation
| Tool | Use |
|---|
| Realtime | See events as they fire |
| DebugView | Detailed event/parameter inspection; requires debug mode |
| GA4 Debug mode | gtag('config', 'G-XXX', { 'debug_mode': true }); or GTM preview |
- Test before launch; verify parameters and naming
- Check for duplicate events, missing values
Output Format
- Event list (name, trigger, parameters)
- Implementation notes (gtag or GTM)
- Conversion mapping
- Testing checklist
Related Skills
- traffic-analysis: UTM, source attribution; attribution for channel optimization
- ai-traffic-tracking: AI traffic in GA4
- google-search-console: GSC analysis (correlate with GA4)
- seo-monitoring: Article database, benchmark, full SEO monitoring framework