# 加⼊现在定义⼀个事件 A,B,C 的漏⽃
[ A"$B"$C ] # 有两个⽤户U1和U2,U1 发⽣了 A,B . U2 发⽣了A,B,C # 第⼀步,计算每个⽤户的漏⽃深度,就是funnel函数⼲的事情, 对于A,B,C 漏⽃,最⼤深度为3, 其中 [A]
=1 ,[A,B] =2, [A,B,C] =3
U1 发⽣ [AB] "$ depth=2
U2 发⽣ [ABC] "$ depth = 3 # 第⼆步,根据没有⽤户深度,计算每个漏⽃层级下的⽤户数,就是funnel_merge⼲的事情
U1 深度为2 "$ [1,1,0] #表示⽤户在漏⽃前两个层级上出现了
U2 深度为3 "$ [1,1,1] # 表示⽤户在漏⽃三个层级上都出现了
合并所有⽤户,计算漏⽃每个层级的总⽤户
[1,1,0] + [1,1,1] = [2,2,1] # 这就是最终结果,表示在这个三层深度的漏⽃上,发⽣事件A有两⼈,之后
这些⼈发⽣事件B的有两⼈,之后这些⼈发⽣事件C的有⼀⼈。
# 再将sql写⼀下
`user_depth = 每个⽤户深度 events.length=漏⽃步奏数,⽐如 A,B,C 那就是3`
select funnel_merge(user_depth, events.length) from(
`event 事件字段, events 就是漏⽃事件,⽐如 'A,B,C'`
select funnel(ctime, window_size, event, events) as user_depth
from ods_news.event
where event in (events)
group by distinct_id
);
03-21
12-31
314
02-25
2476
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交