简体   繁体   English

如何使用 Big Query 计算 GA4 的“平均参与时间”?

[英]How to calculate the "average engagement time" of GA4 using Big Query?

I need to create a "session level" table using big query.我需要使用大查询创建一个“会话级别”表。 For this, I use the session_id, user_speudo_id and other metrics/dimensions.为此,我使用 session_id、user_speudo_id 和其他指标/维度。 When I try to calculate the "average engagement time" of GA4, I use the following formula.当我尝试计算 GA4 的“平均参与时间”时,我使用以下公式。

However, I get 19 minutes with BigQuery while GA4 shows an average engagement time of 30 minutes.但是,我使用 BigQuery 获得了 19 分钟,而 GA4 显示平均参与时间为 30 分钟。 Has anyone ever calculated this metric with BigQuery?有没有人用 BigQuery 计算过这个指标?

SELECT
    DISTINCT ( SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id') AS session_id,
    max((select value.int_value from unnest(event_params) where key = 'engagement_time_msec')) as timeOnSite_ms 
FROM tableXXXX 

try this one试试这个

SELECT 

distinct (SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id')  AS session_id,
sum((select value.int_value from unnest(event_params) where key = 'engagement_time_msec'))/1000 as timeOnSite_sec


FROM table_xxx

group by session_id

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM