[英]GA4 data in BigQuery: How to replicate the engagement rate?
In BigQuery, I'd like to replicate the Google Analytics 4 statistic 'engagement rate', which is defined as ( more info ):在 BigQuery 中,我想复制 Google Analytics 4 统计“参与率”,它被定义为(更多信息):
sessions with engagement / total sessions参与会话数/总会话数
It is required to calculate for all platforms (iOS / Android / Web).需要为所有平台(iOS / Android / Web)计算。 In BigQuery, I'm using the default Google Analytics 4 data import tables.在 BigQuery 中,我使用默认的 Google Analytics 4 数据导入表。
I hereby see various engagement-related parameters, and even the same parameter with different value types, which confuses me a bit:我在这里看到了各种与参与相关的参数,甚至是具有不同值类型的相同参数,这让我有点困惑:
For the replication of engagement rate, it seems option 2 of the above can't be used, since data is only for web, and I need the calculation to do for also ios and android.对于参与率的复制,似乎不能使用上面的选项 2,因为数据仅适用于 web,我还需要计算 ios 和 android。
Following 'option 1' or 'option 3' from the above: The output in BigQuery between these options is more or less equal, there is a very little difference.按照上面的“选项 1”或“选项 3”:这些选项之间 BigQuery 中的 output 大致相等,差异很小。 Comparing the output of both options to the output in the GA4 UI, the numbers don't match;将两个选项的 output 与 GA4 UI 中的 output 进行比较,数字不匹配; in the GA4 UI, they are consistently 3-4% higher for each platform.在 GA4 用户界面中,它们在每个平台上始终高出 3-4%。
Query following 'option 1':查询以下“选项 1”:
SELECT platform,
SAFE_DIVIDE(COUNT(DISTINCT CASE WHEN (SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'session_engaged') = 1 THEN CONCAT(user_pseudo_id,(SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id')) END),COUNT(DISTINCT CONCAT(user_pseudo_id,(SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id')))) AS engagement_rate
FROM `[project id].[dataset id].events_*`
WHERE _table_suffix between '20221008' AND '20221008'
GROUP BY 1
Query following 'option 3':查询以下“选项 3”:
SELECT platform,
SAFE_DIVIDE(COUNT(DISTINCT CASE WHEN (SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'engaged_session_event') = 1 THEN CONCAT(user_pseudo_id,(SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id')) END),COUNT(DISTINCT CONCAT(user_pseudo_id,(SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id')))) AS engagement_rate
FROM `[project id].[dataset id].events_*`
WHERE _table_suffix between '20221008' AND '20221008'
GROUP BY 1
Clear documentation from Google side seem to be missing regarding the parameters session_engaged and engaged_session_event. Google 方面似乎缺少关于参数 session_engaged 和 engaged_session_event 的清晰文档。
I'm looking for more clarity around the following questions:我正在寻找有关以下问题的更多信息:
Does someone knows more about this?有人对此了解更多吗?
Thanks in advance!提前致谢!
Option 1 it is!选项1是!
safe_divide(count(distinct case when (select value.string_value from unnest(event_params) where key = 'session_engaged') = '1' then concat(user_pseudo_id,(select value.int_value from unnest(event_params) where key = 'ga_session_id')) end),count(distinct concat(user_pseudo_id,(select value.int_value from unnest(event_params) where key = 'ga_session_id')))) as engagement_rate
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.