【问题标题】:Calculating engagement time in BigQuery using both user_engagement and screen_view events from Firebase使用 Firebase 中的 user_engagement 和 screen_view 事件计算 BigQuery 中的参与时间
【发布时间】:2020-06-23 06:01:35
【问题描述】:

我有一个关于这篇文章的问题,它描述了如何通过汇总 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 月开始生效。有人知道这是否正确吗?您是同时使用这两个事件还是只使用其中一个?

【问题讨论】:

    标签: google-bigquery firebase-analytics


    【解决方案1】:

    更改已到位。用户参与分布在各种事件中,获取用户参与的正确方法是查询存储在event_params 中的值,而不仅仅是在user_engagement 事件中。否则,您将低估用户在应用中的使用时间。

    从技术上讲,event_params 是 BigQuery 中的一个结构,其中变量名称(键)根据其格式(字符串、整数、浮点数、双精度数和“时间戳”)与值配对。参与时间以毫秒为单位给出一个整数,因此我们需要value.int_value。要访问我们UNNEST() 结构的数据。如果您不擅长取消嵌套,this article on unnesting and working with structs in bigquery 最有帮助。

    This more general, but very thorough tutorial,一般用于查询 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 */
    

    除了 user_engagement 旧事件之外,您还应该看到参与时间分布在 screen_viewfirst_openapp_exception

    【讨论】:

    • 我的问题是在我提出问题时这是否已经实施,因为 Firebase 的博客说这是自 2020 年 4 月以来。我现在可以确认它已在我们的案例中实施,但它只是发生在2021 年 8 月 4 日。因此,请注意何时会出现这种情况。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多