通过事件,可以衡量您的网站或应用中发生的具体互动、操作或行为。例如,您可以使用事件来衡量用户加载页面、点击链接或完成购买之类的操作,或者衡量应用崩溃或展示广告等系统行为。
事件类型
系统会自动收集以下类型的事件:
- 自动收集的事件是指您在网站或应用中设置 Google Analytics 后,系统默认收集的事件。
- 增强型衡量事件是指您在网站或应用中设置 Google Analytics 并启用增强型衡量功能后,系统收集的事件。
以下类型的事件必须先进行实现,然后才能在 Google Analytics 中显示:
- 推荐事件是指由您来实现,但采用预定义名称和参数的事件。这类事件可解锁现有和未来的报告功能。
- 自定义事件是指您定义的事件。请确保仅在没有其他事件适合您的使用情形时,才创建自定义事件。在大多数标准报告中,自定义事件不会显示。因此您需要设置自定义报告或探索才能得到有价值的分析数据。
运作方式
假设在您已添加代码的网站上,用户点击某个链接后跳转到一个外部网站。下面演示了用户点击该链接后会发生的情况:
1 |
2 |
3 |
4 |
用户访问您的网站,并点击指向外部网站的链接 | Google Analytics 收到该点击事件,并在“实时”报告中显示该事件及相关参数 | Google Analytics 全面处理该事件 | Google Analytics 通过在报告、受众群体等工具中使用的维度和指标来显示数据 |
实时查看事件
当事件从网站或应用中发送后,您可以通过以下报告来确认 Google Analytics 是否已成功收集相应事件:
“实时”报告
DebugView 报告
了解关键事件
A key event is an event that measures an action that's particularly important to the success of your business. When someone triggers the event by performing the action, the key event is recorded in Google Analytics and surfaced in your Google Analytics reports.
Any event you collect can become a key event. To measure a key event, create or identify an event that measures the action and then mark the event as a key event. After you mark the event as a key event, you can see how many users perform the action and evaluate marketing performance across all channels that lead users to perform the action.
The following flow shows how to mark an event as a key event. In short, if an event is important to your business's success, you can mark the event as a key event in Analytics.
Event → Key Event
了解事件分组
用户在网站或应用中触发的大多数事件并不会一次发送一个,而是会归为一组来处理(即进行批量处理)。
但在某些情况下,系统不会批量处理事件:
- 系统会在关键事件发生后立即传输它们,哪怕这类事件可能属于某一批次
- 在调试模式下加载的容器绝不会批量处理事件,以便提供实时体验
- 在用户离开页面后,系统会发送设备中保存的事件
- 在不支持
sendBeacon
API 的浏览器环境中,所有事件都会立即发送
注意:如果用户的设备掉线(例如,用户在浏览应用时网络断开),Google Analytics 会将事件数据存储在其设备上,待该设备恢复联网后再发送这些数据。Google Analytics 会忽略在事件触发后超过 72 小时才送达的事件数据。