Hive漏斗分析(计算转换率)

漏斗分析 就是算转换率如:业务相对转换率、绝对转换率
例:用户打开首页——>搜索——>详情页——>加购物车——>下订单——>支付
一系列操作的后的转换率

定义漏斗:
1.活动广告曝光事件:eventid="adShowEvent" ad_id='5'
2.支付点击事件 eventid="appClickEvent" element_id='1'
3.活动参与 eventid="appClickEvent" element_id='6'
4.活动广告点击事件:eventid="adClickEvent" ad_id='5'
5.订单支付页面 eventid="appviewEvent" screen_id='600'

--创建漏斗概况报表:
hive>create table ADS_APP_FUNNEL_OVW_DEMO(
funnel_name string,
stepno      int,
user_counts int,
rel_ratio   double,
abs_ratio   double
)
partitioned by (dt string)
stored as orc;


---实例代码:如何获取人数,一个人可能点击多次广告
hive>with stepone as(
select 
guid
from DWD_APP_GLB_DTL_DEMO
where dt='2023-03-01' and eventid='adShowEvent' and event['adId']='5'
group by guid
)
from stepone
select 
'demo_funnel' as demo_funnel,
'1' as stepno,
count(1) as user_counts

结果:
+--------------+---------+--------------+--+
| demo_funnel  | stepno  | user_counts  |
+--------------+---------+--------------+--+
| demo_funnel  | 1       | 1            |
+--------------+---------+--------------+--+






--完整代码
hive>with stepone as(
select 
guid
from DWD_APP_GLB_DTL_DEMO
where dt='2023-03-01' and eventid='adShowEvent' and event['adId']='5'
group by guid
),
steptwo as(
select 
guid
from DWD_APP_GLB_DTL_DEMO
where dt='2023-03-01' and eventid='appClickEvent' and event['element_id']='1'
group by guid
),
stepthree as(
select 
guid
from DWD_APP_GLB_DTL_DEMO
where dt='2023-03-01' and eventid='appClickEvent' and event['element_id']='6'
group by guid
),
stepfour as(
select 
guid
from DWD_APP_GLB_DTL_DEMO
where dt='2023-03-01' and eventid='adClickEvent' and event['adId']='5'
group by guid	
),
stepfive as(
select 
guid
from DWD_APP_GLB_DTL_DEMO
where dt='2023-03-01' and eventid='appviewEvent' and event['screen_id']='600'
group by guid
),
result as(
from stepone
select 
'demo_funnel' as demo_funnel,
'1' as stepno,
count(1) as user_counts

union all

from steptwo
select 
'demo_funnel' as demo_funnel,
'2' as stepno,
count(1) as user_counts

union all

from stepthree
select 
'demo_funnel' as demo_funnel,
'3' as stepno,
count(1) as user_counts

union all

from stepfour
select 
'demo_funnel' as demo_funnel,
'4' as stepno,
count(1) as user_counts

union all

from stepfive
select 
'demo_funnel' as demo_funnel,
'5' as stepno,
count(1) as user_counts
)
select demo_funnel,stepno,user_counts,
if(stepno=1,1,user_counts/lag(user_counts,1,null) over(partition by demo_funnel order by stepno)) as rel_ratio,
user_counts/first_value(user_counts) over(partition by demo_funnel order by stepno) as abs_ratio
from result;

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
一、课程简介随着技术的飞速发展,经过多年的数据积累,各互联网公司已保存了海量的原始数据和各种业务数据,所以数据仓库技术是各大公司目前都需要着重发展投入的技术领域。数据仓库是面向分析的集成化数据环境,为企业所有决策制定过程,提供系统数据支持的战略集合。通过对数据仓库中数据的分析,可以帮助企业改进业务流程、控制成本、提高产品质量等。二、课程内容本次精心打造的数仓项目的课程,从项目架构的搭建,到数据采集模块的设计、数仓架构的设计、实战需求实现、即席查询的实现,我们针对国内目前广泛使用的Apache原生框架和CDH版本框架进行了分别介绍,Apache原生框架介绍中涉及到的技术框架包括Flume、Kafka、Sqoop、MySql、HDFS、Hive、Tez、Spark、Presto、Druid等,CDH版本框架讲解包括CM的安装部署、Hadoop、Zookeeper、Hive、Flume、Kafka、Oozie、Impala、HUE、Kudu、Spark的安装配置,透彻了解不同版本框架的区别联系,将大数据全生态系统前沿技术一网打尽。在过程中对大数据生态体系进行了系统的讲解,对实际企业数仓项目中可能涉及到的技术点都进行了深入的讲解和探讨。同时穿插了大量数仓基础理论知识,让你在掌握实战经验的同时能够打下坚实的理论基础。三、课程目标本课程以国内电商巨头实际业务应用场景为依托,对电商数仓的常见实战指标以及难点实战指标进行了详尽讲解,具体指标包括:每日、周、月活跃设备明细,留存用户比例,沉默用户、回流用户、流失用户统计,最近连续3周活跃用户统计,最近7天内连续3天活跃用户统计,GMV成交总额分析,转化漏斗分析,品牌复购分析、订单表拉链表的设计等,让学生拥有更直观全面的实战经验。通过对本课程的学习,对数仓项目可以建立起清晰明确的概念,系统全面的掌握各项数仓项目技术,轻松应对各种数仓难题。四、课程亮点本课程结合国内多家企业实际项目经验,特别加入了项目架构模块,从集群规模的确定到框架版本选型以及服务器选型,手把手教你从零开始搭建大数据集群。并且总结大量项目实战中会遇到的问题,针对各个技术框架,均有调优实战经验,具体包括:常用Linux运维命令、Hadoop集群调优、Flume组件选型及性能优化、Kafka集群规模确认及关键参数调优。通过这部分学习,助学生迅速成长,获取前沿技术经验,从容解决实战问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值