Hello,大家好,欢迎使用webfunny。这里将介绍如何将用户的部分历史数据接入到webfunny系统里。
由于将历史数据接入到webfunny中是一项相对复杂的工作,这里只介绍PV,UV数据的接入。 其他类型的数据相对复杂,不再介绍接入方法,也不推荐接入哈。
一、接入每天的PV,UV数据
每天的PV,UV数据存放在InfoCountByDay表中,按照天查询出来的。用户的历史数据,只需要按照规则存放进去就可以看到了。
例如,将2023年6月10日的历史数据导入到InfoCountByDay表中,步骤如下:
1. 创建对应的项目,拿到应用ID,webmonitorId_xxx_pro
2. 获取到该项目每天的PV和UV数据,插入表中,sql如下:
PV数据插入sql如下:
INSERT INTO webfunny_db.InfoCountByDay
(uploadType, webMonitorId, projectVersion, dayName, dayCount, createdAt, updatedAt)
VALUES('pv_count_day', 'webmonitorId_xxx_pro', '1.0.1', '2023-06-10', 1000, '2023-06-10 00:00:00', '2023-06-10 00:00:00');
UV数据插入sql如下:
INSERT INTO webfunny_db.InfoCountByDay
(uploadType, webMonitorId, projectVersion, dayName, dayCount, createdAt, updatedAt)
VALUES('uv_count_day', 'webmonitorId_xxx_pro', '1.0.1', '2023-06-10', 1000, '2023-06-10 00:00:00', '2023-06-10 00:00:00');
新访客UV数据插入sql如下:
INSERT INTO webfunny_db.InfoCountByDay
(uploadType, webMonitorId, projectVersion, dayName, dayCount, createdAt, updatedAt)
VALUES('new_count_day', 'webmonitorId_xxx_pro', '1.0.1', '2023-06-10', 1000, '2023-06-10 00:00:00', '2023-06-10 00:00:00');
IP数量插入sql如下:
INSERT INTO webfunny_db.InfoCountByDay
(uploadType, webMonitorId, projectVersion, dayName, dayCount, createdAt, updatedAt)
VALUES('ip_count_day', 'webmonitorId_xxx_pro', '1.0.1', '2023-06-10', 1000, '2023-06-10 00:00:00', '2023-06-10 00:00:00');
跳出率插入sql如下:
INSERT INTO webfunny_db.InfoCountByDay
(uploadType, webMonitorId, projectVersion, dayName, dayCount, createdAt, updatedAt)
VALUES('cus_leave_for_day', 'webmonitorId_xxx_pro', '1.0.1', '2023-06-10', 1000, '2023-06-10 00:00:00', '2023-06-10 00:00:00');
二、接入每小时的PV,UV数据
每小时的PV,UV数据存放在InfoCountByHour表中,按照时间查询出来的。用户的历史数据,只需要按照规则存放进去就可以看到了,与天数据同理。
例如,将2023年6月10日的24小时历史数据导入到InfoCountByHour表中,步骤如下:
注意:需要循环遍历24小时插入数据。
PV数据插入sql如下:
INSERT INTO webfunny_db.InfoCountByHour
(uploadType, webMonitorId, projectVersion, hourName, hourCount, createdAt, updatedAt)
VALUES('pv_count_hour', 'webmonitorId_xxx_pro', '1.0.1', '06-10 01', 100, '2023-06-10 00:00:01', '2023-06-10 00:00:01');
UV数据插入sql如下:
INSERT INTO webfunny_db.InfoCountByHour
(uploadType, webMonitorId, projectVersion, hourName, hourCount, createdAt, updatedAt)
VALUES('uv_count_hour', 'webmonitorId_xxx_pro', '1.0.1', '06-10 01', 100, '2023-06-10 00:00:01', '2023-06-10 00:00:01');
新访客UV数据插入sql如下:
INSERT INTO webfunny_db.InfoCountByHour
(uploadType, webMonitorId, projectVersion, hourName, hourCount, createdAt, updatedAt)
VALUES('new_count_hour', 'webmonitorId_xxx_pro', '1.0.1', '06-10 01', 100, '2023-06-10 00:00:01', '2023-06-10 00:00:01');
IP数量插入sql如下:
INSERT INTO webfunny_db.InfoCountByHour
(uploadType, webMonitorId, projectVersion, hourName, hourCount, createdAt, updatedAt)
VALUES('ip_count_hour', 'webmonitorId_xxx_pro', '1.0.1', '06-10 01', 100, '2023-06-10 00:00:01', '2023-06-10 00:00:01');
跳出率插入sql如下:
INSERT INTO webfunny_db.InfoCountByHour
(uploadType, webMonitorId, projectVersion, hourName, hourCount, createdAt, updatedAt)
VALUES('cus_leave_for_hour', 'webmonitorId_xxx_pro', '1.0.1', '06-10 01', 100, '2023-06-10 00:00:01', '2023-06-10 00:00:01');