google-bigquery - 使用 Firebase 中的 user_engagement 和 screen_view 事件计算 BigQuery 中的参与时间
问题描述
我有一个关于这篇文章的问题,它描述了如何通过汇总 BigQuery 中的engagement_time_msec 参数来计算参与时间:https ://firebase.googleblog.com/2018/12/new-changes-sessions-user-engagement.html 。代码包含在文章中。
我之前仅根据 user_engagement 事件计算了参与时间,该事件对应于 Firebase Analytics 中报告的参与时间。但是,如果我尝试使用engagement_time_msec(如文章中所述)来实现查找user_engagement 和screen_view 事件的更改,我显然会得到重复的度量,因为参与时间会增加一倍。如果我只使用 user_engagement 事件或仅使用 screen_view 事件,我会得到正确的度量,尽管两者之间存在细微差异,并且 screen_view 并不总是包含engagement_time_msec 参数。
文章说这些变化应该从 2020 年 4 月开始生效。有谁知道这是否正确?你是使用这两个事件还是只使用其中一个?
解决方案
变化已经到位。用户参与分布在各种事件中,获得用户参与的正确方法是查询存储在 中的值event_params
,而不仅仅是在user_engagement
- 事件中。否则,您将低估用户在应用程序中的时间。
从技术上讲,theevent_params
是 BigQuery 中的一个结构,其中变量名称(键)根据其格式(字符串、整数、浮点数、双精度和“时间戳”)与值配对。参与时间以毫秒为单位给出一个整数,因此我们需要value.int_value
. 要访问我们UNNEST()
结构中的数据。如果您不精通取消嵌套,这篇关于取消嵌套和使用 bigquery 中的结构的文章最有帮助。
这个更通用但非常全面的教程,一般处理查询 Firebase 和 Google Analytics 数据。
我注释的模板代码如下所示:
SELECT
user_pseudo_id, /* The user-ID */
event_name, /* */
TIMESTAMP_MICROS(event_timestamp) AS ts, /* Convert into actual time-stamp */
params.value.int_value / 1000 AS secs, /* Extract milliseconds from unnested struct */
FROM `proj.analytics_123456789.events_*`, /* Star the table suffixes to query multiple days */
UNNEST(event_params) AS params /* Unnest the event_params to make every event-line
appear as duplicates for each "line" in the
event_params-struct */
WHERE _TABLE_SUFFIX /* Query multiple tables… */
BETWEEN '20200101' AND /* …from 2020-01-01 … */
FORMAT_DATE("%Y%m%d", CURRENT_DATE()) /* …until today */
AND params.key='engagement_time_msec' /* Select only the unnested rows where an
engagement_time int-value is stored in params */
除了旧的 -events,您应该看到参与时间分布在screen_view
、first_open
和之外。app_exception
user_engagement
推荐阅读
- uwp - uwp 枢轴控件可以在右侧显示其标题选项卡吗?
- docker - Persistent Jupyter Notebooks and Docker?
- r - R:循环显示变量名的问题
- python - 1 月次要刻度标签未在 matplotlib 中显示
- ruby-on-rails - 慢性未选择正确的每月第一个星期一
- windows - 在 Windows 10 上全新安装 intellij idea 2020.1.2 社区版后找不到 gradle-wrapper.properties
- google-analytics - gtag 中未定义 Google Analytics(分析)自定义维度
- php - 使用 TCPDF PHP 库横向显示的图像
- azure - Azure 数据工厂 - 管道、数据集、容器、链接服务
- python - Python使用dlib裁剪人脸图像