互联网在线运营分析平台

1 业务场景与开发流程

(1) 业务场景

  • 统计网站PV和UV
  • 按照终端类型和地域维度汇总

(2) 开发流程

开发流程

2 环境准备

3 数据准备

image-20200919220208673

4 新建数据表

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// 外部表
CREATE EXTERNAL TABLE ots_user_trace_log (
md5 string COMMENT '用户uid的md5值前8位',
uid string COMMENT '用户uid',
ts bigint COMMENT '用户操作时间戳',
ip string COMMENT 'ip地址',
status bigint COMMENT '服务器返回状态码',
bytes bigint COMMENT '返回给客户端的字节数',
device string COMMENT '终端型号',
system string COMMENT '系统版本ios xxx/android xxx',
customize_event string COMMENT '自定义事件:登录/退出/购买/注册/点击/后台/切换用户/浏览',
use_time bigint COMMENT 'APP单次使用时长,当事件为退出、后台、切换用户时有该项',
customize_event_content string COMMENT '用户关注内容信息,在customize_event为浏览和评论时 包含该列'
)
STORED BY 'com.aliyun.odps.TableStoreStorageHandler'
WITH SERDEPROPERTIES (
'tablestore.columns.mapping'=':md5,:uid,:ts, ip,status,bytes,device,system,customize_event,use_time,customize_event_content',
'tablestore.table.name'='user_trace_log'
)
LOCATION 'tablestore://workshop-bj-001.cn-beijing.ots.aliyuncs.com/';

// ODS层
CREATE TABLE IF NOT EXISTS ods_user_trace_log (
md5 STRING COMMENT '用户uid的md5值前8位',
uid STRING COMMENT '用户uid',
ts BIGINT COMMENT '用户操作时间戳',
ip STRING COMMENT 'ip地址',
status BIGINT COMMENT '服务器返回状态码',
bytes BIGINT COMMENT '返回给客户端的字节数',
device STRING COMMENT '终端型号',
system STRING COMMENT '系统版本ios xxx/android xxx',
customize_event STRING COMMENT '自定义事件:登录/退出/购买/注册/点击/后台/切换用户/浏览',
use_time BIGINT COMMENT 'APP单次使用时长,当事件为退出、后台、切换用户时有该项',
customize_event_content STRING COMMENT '用户关注内容信息,在customize_event为浏览和评论时 包含该列'
)
PARTITIONED BY (
dt STRING
);

// DW层
CREATE TABLE IF NOT EXISTS dw_user_trace_log (
uid STRING COMMENT '用户uid',
region STRING COMMENT '地域,根据ip得到',
device_brand string comment '设备品牌',
device STRING COMMENT '终端型号',
system_type STRING COMMENT '系统类型,Android、IOS、ipad、Windows_phone',
customize_event STRING COMMENT '自定义事件:登录/退出/购买/注册/点击/后台/切换用户/浏览',
use_time BIGINT COMMENT 'APP单次使用时长,当事件为退出、后台、切换用户时有该项',
customize_event_content STRING COMMENT '用户关注内容信息,在customize_event为浏览和评论时 包含该列'
)
PARTITIONED BY (
dt STRING
);

// ADS层
CREATE TABLE IF NOT EXISTS rpt_user_trace_log (
country STRING COMMENT '国家',
province STRING COMMENT '省份',
city STRING COMMENT '城市',
device_brand string comment '设备品牌',
device STRING COMMENT '终端型号',
system_type STRING COMMENT '系统类型,Android、IOS、ipad、Windows_phone',
customize_event STRING COMMENT '自定义事件:登录/退出/购买/注册/点击/后台/切换用户/浏览',
use_time BIGINT COMMENT 'APP单次使用时长,当事件为退出、后台、切换用户时有该项',
customize_event_content STRING COMMENT '用户关注内容信息,在customize_event为浏览和评论时 包含该列',
pv bigint comment '浏览量',
uv bigint comment '独立访客'
)
PARTITIONED BY (
dt STRING
);

5 设计工作流

数据生产流程可视化配置

6 节点配置

加载地址和IP转换库

注册自定义处理函数

7 任务提交与测试

补数据测试,查看运行日志

8 数据可视化展现

Quick BI报表创建

参考资料

搭建互联网在线运营分析平台