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

57 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "GA4 Implementation"
type: concept
tags: [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
```javascript
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 Preview**GTM 预览模式验证触发
- **Network Inspection**:检查 gtag.js 请求参数
## Related Concepts
- [[Conversion Tracking]]:转化追踪
- [[Server-Side Tagging]]:服务端标记
- [[Consent Mode]]:同意模式
## Related Entities
- [[Paid Media Tracking & Measurement Specialist]]GA4 实施专家