Files
nexus/wiki/concepts/GA4-Implementation.md
2026-04-20 07:08:14 +08:00

1.7 KiB
Raw Blame History

title, type, tags
title type tags
GA4 Implementation concept
Analytics
Google
Tracking
Measurement

Definition

GA4Google Analytics 4是 Google 的新一代分析平台,基于事件驱动模型提供跨平台、跨设备的学生追踪能力,相比 UA 新增了用户级分析、机器学习预测和隐私优先设计。

Core Features

  • Event-Based Model:所有交互转换为事件(自动收集事件 + 自定义事件)
  • Enhanced Measurement:增强型测量,自动追踪滚动、站点搜索、外链点击、视频互动
  • Custom Dimensions & Metrics:自定义维度和指标
  • Cross-Domain Tracking:跨域追踪
  • Ecommerce DataLayer电商数据层实现view_item、add_to_cart、begin_checkout、purchase

Key Events

Event Description
page_view 页面浏览
view_item 查看产品
add_to_cart 添加到购物车
begin_checkout 开始结账
purchase 完成购买
sign_up 注册
generate_lead 生成 Lead

Data Layer Implementation

dataLayer.push({
  event: 'purchase',
  ecommerce: {
    transaction_id: 'T12345',
    value: 99.00,
    currency: 'USD',
    items: [{
      item_id: 'SKU123',
      item_name: 'Product Name',
      price: 99.00,
      quantity: 1
    }]
  }
});

Debug & Verification

  • GA4 DebugView:实时查看事件发送
  • GTM PreviewGTM 预览模式验证触发
  • Network Inspection:检查 gtag.js 请求参数