带参数的 Firebase 封闭漏斗
Posted
技术标签:
【中文标题】带参数的 Firebase 封闭漏斗【英文标题】:Firebase Closed Funnels With Parameters 【发布时间】:2018-11-30 15:16:48 【问题描述】:我在网上看到过各种Firebase封闭漏斗examples,但都不是参数级别的。
问题:
我想根据 Firebase 事件参数值创建一个封闭的用户漏斗。 更具体地说,我想根据以下 3 个漏斗步骤创建一个封闭的用户漏斗:first_open
(用户第一次打开应用)
Tutorial_LessonStarted
带有参数键 LessonNumber
和参数值 1
Tutorial_LessonStarted
带有参数键 LessonNumber
和参数值 2
(更新)我将原始测试查询移至答案部分。
【问题讨论】:
好吧,至少部分问题是你有e0.event_timestamp > e1_ts
,如果那个e0事件是first_open
,这可能永远不会是真的。您可能打算使用<
我更新了我的代码。请查看下面的答案部分。
【参考方案1】:
SELECT
e0.event_date,
COUNT(DISTINCT e0.user_pseudo_id) AS step1_firstOpeners,
COUNT(DISTINCT e1_user) AS step2_lesson1Started,
COUNT(DISTINCT e2_user) AS step3_lesson2Started
FROM `projectID.analytics_XXXX.events_*` AS e0
LEFT JOIN (SELECT
event_name AS e1_eventname,
e.user_pseudo_id AS e1_user,
event_timestamp AS e1_ts
FROM `projectID.analytics_XXXX.events_*` AS e, UNNEST(e.event_params) as eventparams
WHERE platform = "android"
AND event_name = "Tutorial_LessonStarted"
AND eventparams.key = "LessonNumber"
AND eventparams.value.string_value = "1")
ON e0.user_pseudo_id = e1_user AND e0.event_timestamp < e1_ts AND e1_eventname = "Tutorial_LessonStarted"
LEFT JOIN (SELECT
event_name AS e2_eventname,
e.user_pseudo_id AS e2_user,
event_timestamp AS e2_ts
FROM `projectID.analytics_XXXX.events_*` AS e, UNNEST(e.event_params) as eventparams
WHERE platform = "ANDROID"
AND event_name = "Tutorial_LessonStarted"
AND eventparams.key = "LessonNumber"
AND eventparams.value.string_value = "2")
ON e1_user = e2_user AND e2_ts > e1_ts AND e2_eventname = "Tutorial_LessonStarted"
WHERE
e0.event_name = 'first_open'
AND user_first_touch_timestamp >= 1541808000000000 AND user_first_touch_timestamp < 1541894400000000 -- 10 November 2018
AND _TABLE_SUFFIX = '20181110'
AND platform = "ANDROID"
GROUP BY 1
ORDER BY 1 DESC
【讨论】:
以上是关于带参数的 Firebase 封闭漏斗的主要内容,如果未能解决你的问题,请参考以下文章
通过 BigQuery 访问 Firebase 封闭漏斗中的结构和数组