统计独立访客需求mysql_网站流量分析项目day04

1. 流量分析

a. 基础指标多维度统计分析

统计 PageView 浏览次数(pv)

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

select count(*) from ods_weblog_detail where datestr ="20181101" and valid = "true"; 排除静态资源

View Code

统计Unique Visitor 独立访客(UV)

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

select count(distinct remote_addr) as uvs from ods_weblog_detail where datestr ="20181101";

View Code

统计访问次数(VV)

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

select count(distinct session) as vvs from ods_click_stream_visit where datestr ="20181101";

View Code

ip

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

select count(distinct remote_addr) as ips from ods_weblog_detail where datestr ="20181101";

View Code

结果表

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

create table dw_webflow_basic_info(month string,daystring,

pvbigint,uv bigint ,ip bigint, vv bigint) partitioned by(datestr string);insert into table dw_webflow_basic_info partition(datestr="20181101")select '201811','01',a.*,b.* from(select count(*) as pv,count(distinct remote_addr) as uv,count(distinct remote_addr) asipsfromods_weblog_detailwhere datestr ='20181101') a join(select count(distinct session) as vvs from ods_click_stream_visit where datestr ="20181101") b;

View Code

多维度分析--按照时间

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

方式一:直接在ods_weblog_detail单表上进行查询--计算该处理批次(一天)中的各小时pvs

drop tabledw_pvs_everyhour_oneday;create table dw_pvs_everyhour_oneday(month string,day string,hour string,pvs bigint) partitioned by(datestr string);insert into table dw_pvs_everyhour_oneday partition(datestr='20130918')select a.month as month,a.day as day,a.hour as hour,count(*) as pvs fromods_weblog_detail awhere a.datestr='20130918' group by a.month,a.day,a.hour;--计算每天的pvs

drop tabledw_pvs_everyday;create table dw_pvs_everyday(pvs bigint,month string,daystring);insert into tabledw_pvs_everydayselect count(*) as pvs,a.month as month,a.day as day fromods_weblog_detail agroup by a.month,a.day;

方式二:与时间维表关联查询--维度:日

drop tabledw_pvs_everyday;create table dw_pvs_everyday(pvs bigint,month string,daystring);insert into tabledw_pvs_everydayselect count(*) as pvs,a.month as month,a.day as day from (select distinct month, day fromt_dim_time) ajoinods_weblog_detail bon a.month=b.month and a.day=b.day

group by a.month,a.day;--维度:月

drop tabledw_pvs_everymonth;create table dw_pvs_everymonth (pvs bigint,monthstring);insert into tabledw_pvs_everymonthselect count(*) as pvs,a.month from (select distinct month fromt_dim_time) ajoin ods_weblog_detail b on a.month=b.month group by a.month;--另外,也可以直接利用之前的计算结果。比如从之前算好的小时结果中统计每一天的

Insert into tabledw_pvs_everydaySelect sum(pvs) as pvs,month,day from dw_pvs_everyhour_oneday group by month,day having day='18';

View Code

按照referer、时间维度

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值