Google 大查询 - Firebase 分析 - 屏幕视图的封闭漏斗(参数)

Posted

技术标签:

【中文标题】Google 大查询 - Firebase 分析 - 屏幕视图的封闭漏斗(参数)【英文标题】:Google big query - Firebase analytics - Closed funnel for screen views (parameters) 【发布时间】:2019-02-22 08:04:07 【问题描述】:

我想为我的 X 屏幕视图获得一个封闭的漏斗,这是事件 screen_view 的参数

我找到了这个非常好的教程 - https://medium.com/firebase-developers/how-do-i-create-a-closed-funnel-in-google-analytics-for-firebase-using-bigquery-6eb2645917e1,但它仅适用于带有事件的封闭漏斗。

我想得到这个:

event_name   event_param    count_users
screen_view  screen_name_1  100
screen_view  screen_name_2  50
screen_view  screen_name_3  20
screen_view  screen_name_4  5

我尝试将教程中提供的代码更改为事件参数,但我到了不知道下一步该做什么的地步。

SELECT *,
IF (value.string_value = "screen_name1", user_pseudo_id, NULL) as funnel_1, 
IF (value.string_value = "screen_name1" AND next_event = "screen_name2", user_pseudo_id, NULL) AS funnel_2
FROM (
  SELECT p.value.string_value, user_pseudo_id , event_timestamp,
  LEAD(p.value.string_value, 1) OVER (PARTITION BY user_pseudo_id ORDER BY event_timestamp) AS next_event
  FROM `ProjectName.analytics_XX.events_20190119` as t1, UNNEST(event_params) as p
  WHERE (p.value.string_value = "screen_name1" OR p.value.string_value = "screen_name2")
  ORDER BY 2,3
  LIMIT 100
)

感谢您的帮助!

【问题讨论】:

有人知道该怎么做吗? 【参考方案1】:

我找到了解决办法:

    SELECT COUNT(DISTINCT funnel_1) as f1_users, COUNT(DISTINCT funnel_2) as f2_users FROM (
  SELECT *,
  IF (param.value.string_value = "screen_name1", user_pseudo_id, NULL) AS funnel_1,
  IF (param.value.string_value = "screen_name1" AND next_screen = "screen_name2", user_pseudo_id, NULL) AS funnel_2
  FROM (
    SELECT TIMESTAMP_MICROS(event_timestamp), param, user_pseudo_id,
      LEAD(param.value.string_value, 1) OVER (PARTITION BY user_pseudo_id ORDER BY event_timestamp) as next_screen
    FROM `ProjectName.analytics_XX.events_20190119`, unnest(event_params) as param
    WHERE 
      event_name = "screen_view" and 
      param.value.string_value IN ("screen_name1", "screen_name2")
      AND _TABLE_SUFFIX BETWEEN '20190205' AND '20190312'
  )
)

【讨论】:

以上是关于Google 大查询 - Firebase 分析 - 屏幕视图的封闭漏斗(参数)的主要内容,如果未能解决你的问题,请参考以下文章

Big Query firebase 分析,查询客户的最后请求

Firebase 大查询 - 如何从自定义事件表中检索数据

Firebase Analytics 应用程序和大查询计数用户

一起使用 Firebase 和 Google 分析?

Google Big Table与广告服务器数据分析的大查询

将 Firebase 分析链接到 Google Play