google-analytics-4 - Google Analytics 4 Measurement Protocol 显示事件但没有用户

标签 google-analytics-4

我想通过脚本(使用显式 HTTP 请求)使用 Google Analytics,并且了解带有 Measurement Protocol 的 Google Analytics 4 是可行的方法。我创建了一个新属性,添加了一个 Web 标签,并在那里为 Measurement Protocol 创建了一个 API key 。然后我发送这个请求:

{
    "client_id": "Test-User",
    "user_id": "test_user_id",
    "events": [
        {
            "name": "MyEvent",
            "params": {}
        }
    ]
}

到此网址:https://www.google-analytics.com/mp/collect?measurement_id=G-LQDLGRLGZS&api_secret=JXGZ_CyvTt29ucNi9y0DkA

测量记录在报告的一角:

enter image description here

这些事件不会显示为用户。在报告中,我不太明白如何分析这些事件。有什么方法可以通过发送特殊事件来跟踪用户 session 吗?

最佳答案

我遇到了同样的问题,答案在这里 GA4 Measurement Protocol returns events not the users 在 JSON 的事件分支下,当我添加 “engagement_time_msec”:1 开始统计用户。

"events" : [{
  "name" : "SoftMeter_event",
  "params" : {
    "action" : "From UA-xxxxx [muted]",
    "engagement_time_msec" : 1,
    "label" : "SoftMeter-dev/v1.0.2/lib v1.4.4 DEBUG"
  }
}],

The Measurement Protocol V4 is for GA4 properties(which is also the one you are using).

According to the official document: https://support.google.com/analytics/answer/9408920 It says "Google Analytics 4 properties counts users who engaged with your app/site for any non-zero amount of time during the previous 30 minutes".

GA4 uses "engagement_time_msec" parameter to identify user interaction time. This explains why you can see the number of events but not the number of users. If you want users sent from MP to be counted as active user, simply add the "engagement_time_msec" parameter to your event.

关于google-analytics-4 - Google Analytics 4 Measurement Protocol 显示事件但没有用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70708893/

相关文章:

google-analytics - Google Analytics Reporting API V4 batchGet 方法需要 viewEd,但如何找到它?

google-apps-script - 尝试从应用程序脚本获取谷歌分析 4 数据时出现 403 错误

google-analytics - 通过 API 访问 Google Analytics,但 webProperties 为空

vue.js - Gridsome plugin-google-analytics 跟踪永远不会出现在 A 平台上

php - 如何使用 PHP 客户端库在 GA4 中返回指标总计?

google-tag-manager - 带有 GTM 的 GA4 - 在不使用数据层的情况下将项目数组作为事件参数发送?

arrays - 如何取消嵌套 JSON 数据对象并使用 Snowflake 创建简化的 JSON?

google-apps-script - 尝试使用应用程序脚本获取 Google Analytics 4 时出现身份验证错误