Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bi-report
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data
bi-report
Commits
9573f07c
Commit
9573f07c
authored
Jul 02, 2020
by
魏艺敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update codes
parent
2b525fa9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
479 additions
and
413 deletions
+479
-413
meigou_detail_page_dispense_pv.sql
sqls/meigou_detail_page/meigou_detail_page_dispense_pv.sql
+37
-35
meigou_detail_page_dispense_uv.sql
sqls/meigou_detail_page/meigou_detail_page_dispense_uv.sql
+63
-54
meigou_detail_page_source_pv.sql
sqls/meigou_detail_page/meigou_detail_page_source_pv.sql
+151
-124
meigou_detail_page_source_uv.sql
sqls/meigou_detail_page/meigou_detail_page_source_uv.sql
+228
-200
No files found.
sqls/meigou_detail_page/meigou_detail_page_dispense_pv.sql
View file @
9573f07c
--美购详情页的分发
SELECT
`日期`
,
`设备类型`
,
`活跃类型`
,
`渠道`
,
`美购详情页浏览pv`
,(
`加购物车点击pv`
+
`评价列表页点击pv`
+
`立即支付点击pv`
+
`私信及电话咨询pv`
+
`选择美购项目点击pv`
...
...
@@ -34,9 +35,9 @@ SELECT `日期`,`设备类型`,`活跃类型`,`渠道`
,
concat
(
round
(
`机构导航点击pv`
/
`美购详情页浏览pv`
*
100
,
2
),
'%'
)
as
`机构导航点击pv占比`
FROM
(
(
SELECT
t1
.
partition_date
as
`日期`
,
t1
.
device_os
_type
as
`设备类型`
,
t1
.
device
_type
as
`设备类型`
,
t1
.
active_type
as
`活跃类型`
,
t2
.
channel
as
`渠道`
,
count
(
case
when
type
=
'美购详情页'
then
cl_id
end
)
as
`美购详情页浏览pv`
...
...
@@ -56,7 +57,7 @@ FROM
FROM
(
SELECT
click
.
partition_date
,
click
.
cl_id
,
click
.
type
,
mas
.
active_type
,
mas
.
device_os
_type
,
mas
.
channel
SELECT
click
.
partition_date
,
click
.
cl_id
,
click
.
type
,
mas
.
active_type
,
mas
.
device
_type
,
mas
.
channel
FROM
(
--浏览需要去掉疑似机构刷量的设备
SELECT
pv
.
partition_date
as
partition_date
,
pv
.
cl_id
as
cl_id
,
type
...
...
@@ -64,20 +65,20 @@ FROM
(
SELECT
partition_date
,
cl_id
,
'美购详情页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'page_view'
)
pv
LEFT
JOIN
(
-- 去掉疑似机构刷量的PV和UV
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
FROM
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
FROM
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
...
...
@@ -88,8 +89,8 @@ FROM
SELECT
partition_date
,
cl_id
,
'加购物车'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'welfare_multiattribute_click_add'
...
...
@@ -97,8 +98,8 @@ FROM
SELECT
partition_date
,
cl_id
,
'右上角购物车'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_navbar_cart'
...
...
@@ -106,7 +107,7 @@ FROM
--点击查看更多评论
SELECT
partition_date
,
cl_id
,
'评价列表页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_comment'
...
...
@@ -115,7 +116,7 @@ FROM
--点击外显的评价标签
SELECT
partition_date
,
cl_id
,
'评价列表页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'service_comment_click_tag'
...
...
@@ -124,7 +125,7 @@ FROM
--点击外显的日记卡片
SELECT
partition_date
,
cl_id
,
'评价列表页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'welfare_detail_comment_click_diary_card'
...
...
@@ -133,7 +134,7 @@ FROM
SELECT
partition_date
,
cl_id
,
'立即支付'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'welfare_multiattribute_click_buy'
...
...
@@ -142,7 +143,7 @@ FROM
--点击选择更美项目
SELECT
partition_date
,
cl_id
,
'选择美购项目'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
...
...
@@ -152,7 +153,7 @@ FROM
--7.22新版本--点击外露的美购项目
SELECT
partition_date
,
cl_id
,
'选择美购项目'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
...
...
@@ -162,7 +163,7 @@ FROM
--7.22新版本--点击查看更多
SELECT
partition_date
,
cl_id
,
'选择美购项目'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
...
...
@@ -172,7 +173,7 @@ FROM
--点击私信按钮
SELECT
partition_date
,
cl_id
,
'私信及电话咨询'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_message'
...
...
@@ -181,7 +182,7 @@ FROM
--7.20之后灰度上线的快捷咨询按钮和预约面诊按钮
SELECT
partition_date
,
cl_id
,
'私信及电话咨询'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
...
...
@@ -191,7 +192,7 @@ FROM
--点击机构下面的在线咨询和电话咨询
SELECT
partition_date
,
cl_id
,
'私信及电话咨询'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_curearea_contact'
...
...
@@ -201,7 +202,7 @@ FROM
SELECT
partition_date
,
cl_id
,
'机构主页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_curearea'
...
...
@@ -211,7 +212,7 @@ FROM
SELECT
partition_date
,
cl_id
,
'机构的其他美购'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_seller_service_item'
...
...
@@ -220,7 +221,7 @@ FROM
SELECT
partition_date
,
cl_id
,
'机构导航'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_address'
...
...
@@ -229,7 +230,7 @@ FROM
SELECT
partition_date
,
cl_id
,
'推荐美购'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_card'
...
...
@@ -240,7 +241,7 @@ FROM
SELECT
partition_date
,
cl_id
,
'收藏'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_favor'
...
...
@@ -251,7 +252,7 @@ FROM
SELECT
partition_date
,
cl_id
,
'医生主页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_curearea'
...
...
@@ -261,19 +262,20 @@ FROM
SELECT
partition_date
,
cl_id
,
'分享'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'page_click_share'
)
click
JOIN
(
SELECT
partition_date
,
m
.
device_id
,
device_os_type
SELECT
partition_date
,
device_os_type
as
device_type
,
m
.
device_id
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
or
first_channel_source_type
in
(
'promotion_aisi'
,
'promotion_koomobi_km00'
,
'promotion_koomobi_km01'
)
or
first_channel_source_type
like
'%longyuzhixing%'
or
first_channel_source_type
like
'%jingmeng%'
or
first_channel_source_type
like
'%mailuo%'
THEN
'可疑'
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
...
...
@@ -289,8 +291,8 @@ FROM
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
ON
m
.
device_id
=
a
.
device_id
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
where
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
active_type
in
(
'1'
,
'2'
,
'4'
)
and
first_channel_source_type
not
in
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
...
...
@@ -305,7 +307,7 @@ FROM
AND
click
.
partition_date
=
mas
.
partition_date
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_os
_type
,
t1
.
active_type
,
t2
.
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device
_type
,
t1
.
active_type
,
t2
.
channel
)
T1
ORDER
BY
`日期`
desc
,
`设备类型`
,
`活跃类型`
,
`渠道`
sqls/meigou_detail_page/meigou_detail_page_dispense_uv.sql
View file @
9573f07c
--美购详情页的分发
SELECT
`日期`
,
`设备类型`
,
`活跃类型`
,
`渠道`
,
`美购详情页浏览uv`
,(
`加购物车点击uv`
+
`评价列表页点击uv`
+
`立即支付点击uv`
+
`私信及电话咨询uv`
+
`选择美购项目点击uv`
+
`机构主页点击uv`
+
`机构的其他美购点击uv`
+
`推荐美购点击uv`
+
`收藏点击uv`
+
`右上角购物车点击uv`
+
`医生主页点击uv`
+
`分享点击uv`
+
`机构导航点击uv`
)
as
`美购详情页分发uv加总`
,
concat
(
round
((
`加购物车点击uv`
+
`评价列表页点击uv`
+
`立即支付点击uv`
+
`私信及电话咨询uv`
+
`选择美购项目点击uv`
+
`机构主页点击uv`
+
`机构的其他美购点击uv`
+
`推荐美购点击uv`
+
`收藏点击uv`
+
`右上角购物车点击uv`
+
`医生主页点击uv`
+
`分享点击uv`
+
`机构导航点击uv`
)
/
`美购详情页浏览uv`
*
100
,
2
),
'%'
)
as
`美购详情页分发uv占比加总`
,
`加购物车点击uv`
,
concat
(
round
(
`加购物车点击uv`
/
`美购详情页浏览uv`
*
100
,
2
),
'%'
)
as
`加购物车点击uv占比`
,
`评价列表页点击uv`
...
...
@@ -28,62 +35,62 @@ SELECT `日期`,`设备类型`,`活跃类型`,`渠道`
,
concat
(
round
(
`机构导航点击uv`
/
`美购详情页浏览uv`
*
100
,
2
),
'%'
)
as
`机构导航点击uv占比`
FROM
(
(
SELECT
t1
.
partition_date
as
`日期`
,
t1
.
device_os
_type
as
`设备类型`
,
t1
.
device
_type
as
`设备类型`
,
t1
.
active_type
as
`活跃类型`
,
t2
.
channel
as
`渠道`
,
count
(
distinct
case
when
type
=
'美购详情页'
then
cl_id
end
)
as
`美购详情页浏览uv`
,
count
(
distinct
case
when
type
=
'加购物车'
then
cl_id
end
)
as
`加购物车点击uv`
,
count
(
distinct
case
when
type
=
'评价列表页'
then
cl_id
end
)
as
`评价列表页点击uv`
,
count
(
distinct
case
when
type
=
'立即支付'
then
cl_id
end
)
as
`立即支付点击uv`
,
count
(
distinct
case
when
type
=
'私信及电话咨询'
then
cl_id
end
)
as
`私信及电话咨询uv`
,
count
(
distinct
case
when
type
=
'选择美购项目'
then
cl_id
end
)
as
`选择美购项目点击uv`
,
count
(
distinct
case
when
type
=
'机构主页'
then
cl_id
end
)
as
`机构主页点击uv`
,
count
(
distinct
case
when
type
=
'机构的其他美购'
then
cl_id
end
)
as
`机构的其他美购点击uv`
,
count
(
distinct
case
when
type
=
'推荐美购'
then
cl_id
end
)
as
`推荐美购点击uv`
,
count
(
distinct
case
when
type
=
'收藏'
then
cl_id
end
)
as
`收藏点击uv`
,
count
(
distinct
case
when
type
=
'右上角购物车'
then
cl_id
end
)
as
`右上角购物车点击uv`
,
count
(
distinct
case
when
type
=
'医生主页'
then
cl_id
end
)
as
`医生主页点击uv`
,
count
(
distinct
case
when
type
=
'分享'
then
cl_id
end
)
as
`分享点击uv`
,
count
(
distinct
case
when
type
=
'机构导航'
then
cl_id
end
)
as
`机构导航点击uv`
,
count
(
case
when
type
=
'美购详情页'
then
cl_id
end
)
as
`美购详情页浏览uv`
,
count
(
case
when
type
=
'加购物车'
then
cl_id
end
)
as
`加购物车点击uv`
,
count
(
case
when
type
=
'评价列表页'
then
cl_id
end
)
as
`评价列表页点击uv`
,
count
(
case
when
type
=
'立即支付'
then
cl_id
end
)
as
`立即支付点击uv`
,
count
(
case
when
type
=
'私信及电话咨询'
then
cl_id
end
)
as
`私信及电话咨询uv`
,
count
(
case
when
type
=
'选择美购项目'
then
cl_id
end
)
as
`选择美购项目点击uv`
,
count
(
case
when
type
=
'机构主页'
then
cl_id
end
)
as
`机构主页点击uv`
,
count
(
case
when
type
=
'机构的其他美购'
then
cl_id
end
)
as
`机构的其他美购点击uv`
,
count
(
case
when
type
=
'推荐美购'
then
cl_id
end
)
as
`推荐美购点击uv`
,
count
(
case
when
type
=
'收藏'
then
cl_id
end
)
as
`收藏点击uv`
,
count
(
case
when
type
=
'右上角购物车'
then
cl_id
end
)
as
`右上角购物车点击uv`
,
count
(
case
when
type
=
'医生主页'
then
cl_id
end
)
as
`医生主页点击uv`
,
count
(
case
when
type
=
'分享'
then
cl_id
end
)
as
`分享点击uv`
,
count
(
case
when
type
=
'机构导航'
then
cl_id
end
)
as
`机构导航点击uv`
FROM
(
SELECT
click
.
partition_date
,
click
.
cl_id
,
click
.
type
,
mas
.
active_type
,
mas
.
device_os
_type
,
mas
.
channel
SELECT
click
.
partition_date
,
click
.
cl_id
,
click
.
type
,
mas
.
active_type
,
mas
.
device
_type
,
mas
.
channel
FROM
(
--浏览需要去掉疑似机构刷量的设备
SELECT
pv
.
partition_date
as
partition_date
,
p
v
.
cl_id
as
cl_id
,
type
SELECT
uv
.
partition_date
as
partition_date
,
u
v
.
cl_id
as
cl_id
,
type
FROM
(
SELECT
partition_date
,
cl_id
,
'美购详情页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'page_view'
)
p
v
)
u
v
LEFT
JOIN
(
(
-- 去掉疑似机构刷量的UV和UV
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
FROM
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
FROM
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
on
p
v
.
cl_id
=
spam_pv
.
cl_id
on
u
v
.
cl_id
=
spam_pv
.
cl_id
WHERE
spam_pv
.
cl_id
IS
NULL
UNION
ALL
SELECT
partition_date
,
cl_id
,
'加购物车'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'welfare_multiattribute_click_add'
...
...
@@ -91,8 +98,8 @@ FROM
SELECT
partition_date
,
cl_id
,
'右上角购物车'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_navbar_cart'
...
...
@@ -100,7 +107,7 @@ FROM
--点击查看更多评论
SELECT
partition_date
,
cl_id
,
'评价列表页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_comment'
...
...
@@ -109,7 +116,7 @@ FROM
--点击外显的评价标签
SELECT
partition_date
,
cl_id
,
'评价列表页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'service_comment_click_tag'
...
...
@@ -118,7 +125,7 @@ FROM
--点击外显的日记卡片
SELECT
partition_date
,
cl_id
,
'评价列表页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'welfare_detail_comment_click_diary_card'
...
...
@@ -127,7 +134,7 @@ FROM
SELECT
partition_date
,
cl_id
,
'立即支付'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'welfare_multiattribute_click_buy'
...
...
@@ -136,7 +143,7 @@ FROM
--点击选择更美项目
SELECT
partition_date
,
cl_id
,
'选择美购项目'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
...
...
@@ -146,7 +153,7 @@ FROM
--7.22新版本--点击外露的美购项目
SELECT
partition_date
,
cl_id
,
'选择美购项目'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
...
...
@@ -156,7 +163,7 @@ FROM
--7.22新版本--点击查看更多
SELECT
partition_date
,
cl_id
,
'选择美购项目'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
...
...
@@ -166,7 +173,7 @@ FROM
--点击私信按钮
SELECT
partition_date
,
cl_id
,
'私信及电话咨询'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_message'
...
...
@@ -175,7 +182,7 @@ FROM
--7.20之后灰度上线的快捷咨询按钮和预约面诊按钮
SELECT
partition_date
,
cl_id
,
'私信及电话咨询'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
...
...
@@ -185,7 +192,7 @@ FROM
--点击机构下面的在线咨询和电话咨询
SELECT
partition_date
,
cl_id
,
'私信及电话咨询'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_curearea_contact'
...
...
@@ -195,7 +202,7 @@ FROM
SELECT
partition_date
,
cl_id
,
'机构主页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_curearea'
...
...
@@ -205,7 +212,7 @@ FROM
SELECT
partition_date
,
cl_id
,
'机构的其他美购'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_seller_service_item'
...
...
@@ -214,7 +221,7 @@ FROM
SELECT
partition_date
,
cl_id
,
'机构导航'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_address'
...
...
@@ -223,7 +230,7 @@ FROM
SELECT
partition_date
,
cl_id
,
'推荐美购'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_card'
...
...
@@ -234,7 +241,7 @@ FROM
SELECT
partition_date
,
cl_id
,
'收藏'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_favor'
...
...
@@ -245,7 +252,7 @@ FROM
SELECT
partition_date
,
cl_id
,
'医生主页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_curearea'
...
...
@@ -255,19 +262,20 @@ FROM
SELECT
partition_date
,
cl_id
,
'分享'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'page_click_share'
)
click
JOIN
(
SELECT
partition_date
,
m
.
device_id
,
device_os_type
SELECT
partition_date
,
device_os_type
as
device_type
,
m
.
device_id
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
or
first_channel_source_type
in
(
'promotion_aisi'
,
'promotion_koomobi_km00'
,
'promotion_koomobi_km01'
)
or
first_channel_source_type
like
'%longyuzhixing%'
or
first_channel_source_type
like
'%jingmeng%'
or
first_channel_source_type
like
'%mailuo%'
THEN
'可疑'
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
...
...
@@ -283,8 +291,8 @@ FROM
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
ON
m
.
device_id
=
a
.
device_id
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
where
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
active_type
in
(
'1'
,
'2'
,
'4'
)
and
first_channel_source_type
not
in
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
...
...
@@ -299,6 +307,7 @@ FROM
AND
click
.
partition_date
=
mas
.
partition_date
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_os
_type
,
t1
.
active_type
,
t2
.
channel
)
T1
GROUP
BY
t1
.
partition_date
,
t1
.
device
_type
,
t1
.
active_type
,
t2
.
channel
)
T1
ORDER
BY
`日期`
desc
,
`设备类型`
,
`活跃类型`
,
`渠道`
sqls/meigou_detail_page/meigou_detail_page_source_pv.sql
View file @
9573f07c
--美购详情页的来源
SELECT
T1
.
partition_date
as
`日期`
,
T1
.
device_os
_type
as
`设备类型`
,
T1
.
device
_type
as
`设备类型`
,
T1
.
active_type
as
`活跃类型`
,
T1
.
channel
as
`渠道`
,
T1
.
wel_pv
as
`美购详情页pv`
...
...
@@ -19,16 +21,6 @@ SELECT T1.partition_date as `日期`
,
concat
(
round
(
T3
.
result_wel_add_pv
/
T2
.
search_result_welfare_pv
*
100
,
2
),
'%'
)
as
`搜索结果美购页-点击加车率`
,
concat
(
round
(
T3
.
result_wel_buy_pv
/
T2
.
search_result_welfare_pv
*
100
,
2
),
'%'
)
as
`搜索结果美购页-点击立即支付率`
,
concat
(
round
(
T3
.
result_wel_msg_pv
/
T2
.
search_result_welfare_pv
*
100
,
2
),
'%'
)
as
`搜索结果美购页-点击私信咨询率`
,
T1
.
welfare_list_pv
as
`美购列表页pv`
,
T2
.
welfare_list_pv
as
`美购列表页-转化pv`
,
T3
.
wel_list_add_pv
as
`美购列表页-转化点击加车pv`
,
T3
.
wel_list_buy_pv
as
`美购列表页-转化点击立即支付pv`
,
T3
.
wel_list_msg_pv
as
`美购列表页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
welfare_list_pv
/
T1
.
welfare_list_pv
*
100
,
2
),
'%'
)
as
`美购列表页-转化pv率`
,
concat
(
round
(
T2
.
welfare_list_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`美购列表页-转化美购pv占比`
,
concat
(
round
(
T3
.
wel_list_add_pv
/
T2
.
welfare_list_pv
*
100
,
2
),
'%'
)
as
`美购列表页-点击加车率`
,
concat
(
round
(
T3
.
wel_list_buy_pv
/
T2
.
welfare_list_pv
*
100
,
2
),
'%'
)
as
`美购列表页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_list_msg_pv
/
T2
.
welfare_list_pv
*
100
,
2
),
'%'
)
as
`美购列表页-点击私信咨询率`
,
T1
.
organization_detail_pv
as
`医院主页pv`
,
T2
.
organization_detail_pv
as
`医院主页-转化pv`
,
T3
.
org_add_pv
as
`医院主页-转化点击加车pv`
...
...
@@ -49,26 +41,26 @@ SELECT T1.partition_date as `日期`
,
concat
(
round
(
T3
.
category_add_pv
/
T2
.
category_pv
*
100
,
2
),
'%'
)
as
`品类聚合页-点击加车率`
,
concat
(
round
(
T3
.
category_buy_pv
/
T2
.
category_pv
*
100
,
2
),
'%'
)
as
`品类聚合页-点击立即支付率`
,
concat
(
round
(
T3
.
category_msg_pv
/
T2
.
category_pv
*
100
,
2
),
'%'
)
as
`品类聚合页-点击私信咨询率`
,
T1
.
sign_pv
as
`签到
页pv`
,
T2
.
sign_pv
as
`签到
页-转化pv`
,
T3
.
sign_add_pv
as
`签到
页-转化点击加车pv`
,
T3
.
sign_buy_pv
as
`签到
页-转化点击立即支付pv`
,
T3
.
sign_msg_pv
as
`签到
页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
sign_pv
/
T1
.
sign_pv
*
100
,
2
),
'%'
)
as
`签到
页-转化pv率`
,
concat
(
round
(
T2
.
sign_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`签到
页-转化美购pv占比`
,
concat
(
round
(
T3
.
sign_add_pv
/
T2
.
sign_pv
*
100
,
2
),
'%'
)
as
`签到
页-点击加车率`
,
concat
(
round
(
T3
.
sign_buy_pv
/
T2
.
sign_pv
*
100
,
2
),
'%'
)
as
`签到
页-点击立即支付率`
,
concat
(
round
(
T3
.
sign_msg_pv
/
T2
.
sign_pv
*
100
,
2
),
'%'
)
as
`签到
页-点击私信咨询率`
,
T1
.
special_pv
as
`专题和大促
页pv`
,
T2
.
special_pv
as
`专题和大促
页-转化pv`
,
T3
.
special_add_pv
as
`专题和大促
页-转化点击加车pv`
,
T3
.
special_buy_pv
as
`专题和大促
页-转化点击立即支付pv`
,
T3
.
special_msg_pv
as
`专题和大促
页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
special_pv
/
T1
.
special_pv
*
100
,
2
),
'%'
)
as
`专题和大促
页-转化pv率`
,
concat
(
round
(
T2
.
special_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`专题和大促
页-转化美购pv占比`
,
concat
(
round
(
T3
.
special_add_pv
/
T2
.
special_pv
*
100
,
2
),
'%'
)
as
`专题和大促
页-点击加车率`
,
concat
(
round
(
T3
.
special_buy_pv
/
T2
.
special_pv
*
100
,
2
),
'%'
)
as
`专题和大促
页-点击立即支付率`
,
concat
(
round
(
T3
.
special_msg_pv
/
T2
.
special_pv
*
100
,
2
),
'%'
)
as
`专题和大促
页-点击私信咨询率`
,
T1
.
conversation_detail_pv
as
`私信详情
页pv`
,
T2
.
conversation_detail_pv
as
`私信详情
页-转化pv`
,
T3
.
conv_add_pv
as
`私信详情
页-转化点击加车pv`
,
T3
.
conv_buy_pv
as
`私信详情
页-转化点击立即支付pv`
,
T3
.
conv_msg_pv
as
`私信详情
页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
conversation_detail_pv
/
T1
.
conversation_detail_pv
*
100
,
2
),
'%'
)
as
`私信详情
页-转化pv率`
,
concat
(
round
(
T2
.
conversation_detail_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`私信详情
页-转化美购pv占比`
,
concat
(
round
(
T3
.
conv_add_pv
/
T2
.
conversation_detail_pv
*
100
,
2
),
'%'
)
as
`私信详情
页-点击加车率`
,
concat
(
round
(
T3
.
conv_buy_pv
/
T2
.
conversation_detail_pv
*
100
,
2
),
'%'
)
as
`私信详情
页-点击立即支付率`
,
concat
(
round
(
T3
.
conv_msg_pv
/
T2
.
conversation_detail_pv
*
100
,
2
),
'%'
)
as
`私信详情
页-点击私信咨询率`
,
T1
.
welfare_list_pv
as
`美购列表
页pv`
,
T2
.
welfare_list_pv
as
`美购列表
页-转化pv`
,
T3
.
wel_list_add_pv
as
`美购列表
页-转化点击加车pv`
,
T3
.
wel_list_buy_pv
as
`美购列表
页-转化点击立即支付pv`
,
T3
.
wel_list_msg_pv
as
`美购列表
页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
welfare_list_pv
/
T1
.
welfare_list_pv
*
100
,
2
),
'%'
)
as
`美购列表
页-转化pv率`
,
concat
(
round
(
T2
.
welfare_list_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`美购列表
页-转化美购pv占比`
,
concat
(
round
(
T3
.
wel_list_add_pv
/
T2
.
welfare_list_pv
*
100
,
2
),
'%'
)
as
`美购列表
页-点击加车率`
,
concat
(
round
(
T3
.
wel_list_buy_pv
/
T2
.
welfare_list_pv
*
100
,
2
),
'%'
)
as
`美购列表
页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_list_msg_pv
/
T2
.
welfare_list_pv
*
100
,
2
),
'%'
)
as
`美购列表
页-点击私信咨询率`
,
T1
.
my_cart_pv
as
`购物车pv`
,
T2
.
my_cart_pv
as
`购物车-转化pv`
,
T3
.
cart_add_pv
as
`购物车-转化点击加车pv`
...
...
@@ -89,36 +81,6 @@ SELECT T1.partition_date as `日期`
,
concat
(
round
(
T3
.
result_more_add_pv
/
T2
.
search_result_more_pv
*
100
,
2
),
'%'
)
as
`搜索结果综合页-点击加车率`
,
concat
(
round
(
T3
.
result_more_buy_pv
/
T2
.
search_result_more_pv
*
100
,
2
),
'%'
)
as
`搜索结果综合页-点击立即支付率`
,
concat
(
round
(
T3
.
result_more_msg_pv
/
T2
.
search_result_more_pv
*
100
,
2
),
'%'
)
as
`搜索结果综合页-点击私信咨询率`
,
T1
.
welfare_home_pv
as
`美购首页pv`
,
T2
.
welfare_home_pv
as
`美购首页-转化pv`
,
T3
.
wel_home_add_pv
as
`美购首页-转化点击加车pv`
,
T3
.
wel_home_buy_pv
as
`美购首页-转化点击立即支付pv`
,
T3
.
wel_home_msg_pv
as
`美购首页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
welfare_home_pv
/
T1
.
welfare_home_pv
*
100
,
2
),
'%'
)
as
`美购首页-转化pv率`
,
concat
(
round
(
T2
.
welfare_home_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`美购首页-转化美购pv占比`
,
concat
(
round
(
T3
.
wel_home_add_pv
/
T2
.
welfare_home_pv
*
100
,
2
),
'%'
)
as
`美购首页-点击加车率`
,
concat
(
round
(
T3
.
wel_home_buy_pv
/
T2
.
welfare_home_pv
*
100
,
2
),
'%'
)
as
`美购首页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_home_msg_pv
/
T2
.
welfare_home_pv
*
100
,
2
),
'%'
)
as
`美购首页-点击私信咨询率`
,
T1
.
conversation_detail_pv
as
`私信详情页pv`
,
T2
.
conversation_detail_pv
as
`私信详情页-转化pv`
,
T3
.
conv_add_pv
as
`私信详情页-转化点击加车pv`
,
T3
.
conv_buy_pv
as
`私信详情页-转化点击立即支付pv`
,
T3
.
conv_msg_pv
as
`私信详情页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
conversation_detail_pv
/
T1
.
conversation_detail_pv
*
100
,
2
),
'%'
)
as
`私信详情页-转化pv率`
,
concat
(
round
(
T2
.
conversation_detail_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`私信详情页-转化美购pv占比`
,
concat
(
round
(
T3
.
conv_add_pv
/
T2
.
conversation_detail_pv
*
100
,
2
),
'%'
)
as
`私信详情页-点击加车率`
,
concat
(
round
(
T3
.
conv_buy_pv
/
T2
.
conversation_detail_pv
*
100
,
2
),
'%'
)
as
`私信详情页-点击立即支付率`
,
concat
(
round
(
T3
.
conv_msg_pv
/
T2
.
conversation_detail_pv
*
100
,
2
),
'%'
)
as
`私信详情页-点击私信咨询率`
,
T1
.
wel_pv
as
`美购详情页pv`
,
T2
.
wel_pv
as
`其他美购详情页-转化pv`
,
T3
.
wel_add_pv
as
`其他美购详情页-转化点击加车pv`
,
T3
.
wel_buy_pv
as
`其他美购详情页-转化点击立即支付pv`
,
T3
.
wel_msg_pv
as
`其他美购详情页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
wel_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`其他美购详情页-转化pv率`
,
concat
(
round
(
T2
.
wel_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`其他美购详情页-转化美购pv占比`
,
concat
(
round
(
T3
.
wel_add_pv
/
T2
.
wel_pv
*
100
,
2
),
'%'
)
as
`其他美购详情页-点击加车率`
,
concat
(
round
(
T3
.
wel_buy_pv
/
T2
.
wel_pv
*
100
,
2
),
'%'
)
as
`其他美购详情页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_msg_pv
/
T2
.
wel_pv
*
100
,
2
),
'%'
)
as
`其他美购详情页-点击私信咨询率`
,
T1
.
order_detail_pv
as
`订单详情页pv`
,
T2
.
order_detail_pv
as
`订单详情页-转化pv`
,
T3
.
order_add_pv
as
`订单详情页-转化点击加车pv`
...
...
@@ -129,6 +91,16 @@ SELECT T1.partition_date as `日期`
,
concat
(
round
(
T3
.
order_add_pv
/
T2
.
order_detail_pv
*
100
,
2
),
'%'
)
as
`订单详情页-点击加车率`
,
concat
(
round
(
T3
.
order_buy_pv
/
T2
.
order_detail_pv
*
100
,
2
),
'%'
)
as
`订单详情页-点击立即支付率`
,
concat
(
round
(
T3
.
order_msg_pv
/
T2
.
order_detail_pv
*
100
,
2
),
'%'
)
as
`订单详情页-点击私信咨询率`
,
T1
.
special_pv
as
`专题和大促页pv`
,
T2
.
special_pv
as
`专题和大促页-转化pv`
,
T3
.
special_add_pv
as
`专题和大促页-转化点击加车pv`
,
T3
.
special_buy_pv
as
`专题和大促页-转化点击立即支付pv`
,
T3
.
special_msg_pv
as
`专题和大促页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
special_pv
/
T1
.
special_pv
*
100
,
2
),
'%'
)
as
`专题和大促页-转化pv率`
,
concat
(
round
(
T2
.
special_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`专题和大促页-转化美购pv占比`
,
concat
(
round
(
T3
.
special_add_pv
/
T2
.
special_pv
*
100
,
2
),
'%'
)
as
`专题和大促页-点击加车率`
,
concat
(
round
(
T3
.
special_buy_pv
/
T2
.
special_pv
*
100
,
2
),
'%'
)
as
`专题和大促页-点击立即支付率`
,
concat
(
round
(
T3
.
special_msg_pv
/
T2
.
special_pv
*
100
,
2
),
'%'
)
as
`专题和大促页-点击私信咨询率`
,
T1
.
expert_detail_pv
as
`医生主页pv`
,
T2
.
expert_detail_pv
as
`医生主页-转化pv`
,
T3
.
exp_add_pv
as
`医生主页-转化点击加车pv`
...
...
@@ -139,16 +111,26 @@ SELECT T1.partition_date as `日期`
,
concat
(
round
(
T3
.
exp_add_pv
/
T2
.
expert_detail_pv
*
100
,
2
),
'%'
)
as
`医生主页-点击加车率`
,
concat
(
round
(
T3
.
exp_buy_pv
/
T2
.
expert_detail_pv
*
100
,
2
),
'%'
)
as
`医生主页-点击立即支付率`
,
concat
(
round
(
T3
.
exp_msg_pv
/
T2
.
expert_detail_pv
*
100
,
2
),
'%'
)
as
`医生主页-点击私信咨询率`
,
T1
.
ai_report_pv
as
`AI结果页pv`
,
T2
.
ai_report_pv
as
`AI结果页-转化pv`
,
T3
.
ai_add_pv
as
`AI结果页-转化点击加车pv`
,
T3
.
ai_buy_pv
as
`AI结果页-转化点击立即支付pv`
,
T3
.
ai_msg_pv
as
`AI结果页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
ai_report_pv
/
T1
.
ai_report_pv
*
100
,
2
),
'%'
)
as
`AI结果页-转化pv率`
,
concat
(
round
(
T2
.
ai_report_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`AI结果页-转化美购pv占比`
,
concat
(
round
(
T3
.
ai_add_pv
/
T2
.
ai_report_pv
*
100
,
2
),
'%'
)
as
`AI结果页-点击加车率`
,
concat
(
round
(
T3
.
ai_buy_pv
/
T2
.
ai_report_pv
*
100
,
2
),
'%'
)
as
`AI结果页-点击立即支付率`
,
concat
(
round
(
T3
.
ai_msg_pv
/
T2
.
ai_report_pv
*
100
,
2
),
'%'
)
as
`AI结果页-点击私信咨询率`
,
T1
.
wel_pv
as
`美购详情页pv`
,
T2
.
wel_pv
as
`其他美购详情页-转化pv`
,
T3
.
wel_add_pv
as
`其他美购详情页-转化点击加车pv`
,
T3
.
wel_buy_pv
as
`其他美购详情页-转化点击立即支付pv`
,
T3
.
wel_msg_pv
as
`其他美购详情页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
wel_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`其他美购详情页-转化pv率`
,
concat
(
round
(
T2
.
wel_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`其他美购详情页-转化美购pv占比`
,
concat
(
round
(
T3
.
wel_add_pv
/
T2
.
wel_pv
*
100
,
2
),
'%'
)
as
`其他美购详情页-点击加车率`
,
concat
(
round
(
T3
.
wel_buy_pv
/
T2
.
wel_pv
*
100
,
2
),
'%'
)
as
`其他美购详情页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_msg_pv
/
T2
.
wel_pv
*
100
,
2
),
'%'
)
as
`其他美购详情页-点击私信咨询率`
,
T1
.
welfare_home_pv
as
`美购首页pv`
,
T2
.
welfare_home_pv
as
`美购首页-转化pv`
,
T3
.
wel_home_add_pv
as
`美购首页-转化点击加车pv`
,
T3
.
wel_home_buy_pv
as
`美购首页-转化点击立即支付pv`
,
T3
.
wel_home_msg_pv
as
`美购首页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
welfare_home_pv
/
T1
.
welfare_home_pv
*
100
,
2
),
'%'
)
as
`美购首页-转化pv率`
,
concat
(
round
(
T2
.
welfare_home_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`美购首页-转化美购pv占比`
,
concat
(
round
(
T3
.
wel_home_add_pv
/
T2
.
welfare_home_pv
*
100
,
2
),
'%'
)
as
`美购首页-点击加车率`
,
concat
(
round
(
T3
.
wel_home_buy_pv
/
T2
.
welfare_home_pv
*
100
,
2
),
'%'
)
as
`美购首页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_home_msg_pv
/
T2
.
welfare_home_pv
*
100
,
2
),
'%'
)
as
`美购首页-点击私信咨询率`
,
T1
.
diary_detail_pv
as
`日记本详情页pv`
,
T2
.
diary_detail_pv
as
`日记本详情页-转化pv`
,
T3
.
diary_add_pv
as
`日记本详情页-转化点击加车pv`
...
...
@@ -159,6 +141,26 @@ SELECT T1.partition_date as `日期`
,
concat
(
round
(
T3
.
diary_add_pv
/
T2
.
diary_detail_pv
*
100
,
2
),
'%'
)
as
`日记本详情页-点击加车率`
,
concat
(
round
(
T3
.
diary_buy_pv
/
T2
.
diary_detail_pv
*
100
,
2
),
'%'
)
as
`日记本详情页-点击立即支付率`
,
concat
(
round
(
T3
.
diary_msg_pv
/
T2
.
diary_detail_pv
*
100
,
2
),
'%'
)
as
`日记本详情页-点击私信咨询率`
,
T1
.
sign_pv
as
`签到页pv`
,
T2
.
sign_pv
as
`签到页-转化pv`
,
T3
.
sign_add_pv
as
`签到页-转化点击加车pv`
,
T3
.
sign_buy_pv
as
`签到页-转化点击立即支付pv`
,
T3
.
sign_msg_pv
as
`签到页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
sign_pv
/
T1
.
sign_pv
*
100
,
2
),
'%'
)
as
`签到页-转化pv率`
,
concat
(
round
(
T2
.
sign_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`签到页-转化美购pv占比`
,
concat
(
round
(
T3
.
sign_add_pv
/
T2
.
sign_pv
*
100
,
2
),
'%'
)
as
`签到页-点击加车率`
,
concat
(
round
(
T3
.
sign_buy_pv
/
T2
.
sign_pv
*
100
,
2
),
'%'
)
as
`签到页-点击立即支付率`
,
concat
(
round
(
T3
.
sign_msg_pv
/
T2
.
sign_pv
*
100
,
2
),
'%'
)
as
`签到页-点击私信咨询率`
,
T1
.
ai_report_pv
as
`AI结果页pv`
,
T2
.
ai_report_pv
as
`AI结果页-转化pv`
,
T3
.
ai_add_pv
as
`AI结果页-转化点击加车pv`
,
T3
.
ai_buy_pv
as
`AI结果页-转化点击立即支付pv`
,
T3
.
ai_msg_pv
as
`AI结果页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
ai_report_pv
/
T1
.
ai_report_pv
*
100
,
2
),
'%'
)
as
`AI结果页-转化pv率`
,
concat
(
round
(
T2
.
ai_report_pv
/
T1
.
wel_pv
*
100
,
2
),
'%'
)
as
`AI结果页-转化美购pv占比`
,
concat
(
round
(
T3
.
ai_add_pv
/
T2
.
ai_report_pv
*
100
,
2
),
'%'
)
as
`AI结果页-点击加车率`
,
concat
(
round
(
T3
.
ai_buy_pv
/
T2
.
ai_report_pv
*
100
,
2
),
'%'
)
as
`AI结果页-点击立即支付率`
,
concat
(
round
(
T3
.
ai_msg_pv
/
T2
.
ai_report_pv
*
100
,
2
),
'%'
)
as
`AI结果页-点击私信咨询率`
,
T1
.
zone_pv
as
`内容聚合页pv`
,
T2
.
zone_pv
as
`内容聚合页-转化pv`
,
T3
.
zone_add_pv
as
`内容聚合页-转化点击加车pv`
...
...
@@ -171,9 +173,9 @@ SELECT T1.partition_date as `日期`
,
concat
(
round
(
T3
.
zone_msg_pv
/
T2
.
zone_pv
*
100
,
2
),
'%'
)
as
`内容聚合页-点击私信咨询率`
FROM
(
--能够走向美购详情页的各页面pv/uv
(
--能够走向美购详情页的各页面pv/uv
SELECT
t1
.
partition_date
,
t1
.
device_
os_
type
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
,
count
(
case
when
page_name
=
'welfare_detail'
then
t1
.
cl_id
end
)
as
wel_pv
...
...
@@ -189,29 +191,30 @@ FROM
,
count
(
case
when
page_name
=
'diary_detail'
then
t1
.
cl_id
end
)
as
diary_detail_pv
,
count
(
case
when
page_name
=
'order_detail'
then
t1
.
cl_id
end
)
as
order_detail_pv
,
count
(
case
when
page_name
=
'new_sign'
then
t1
.
cl_id
end
)
as
sign_pv
,
count
(
case
when
page_name
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
)
then
t1
.
cl_id
end
)
as
special_pv
--专题和大促
,
count
(
case
when
page_name
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
,
'custom_special'
)
then
t1
.
cl_id
end
)
as
special_pv
--专题和大促
,
count
(
case
when
page_name
=
'zone_v3'
then
t1
.
cl_id
end
)
as
zone_pv
,
count
(
case
when
page_name
in
(
'report_result'
,
'face_detect_result'
)
then
t1
.
cl_id
end
)
as
ai_report_pv
--待之后增加模拟整形页面
FROM
(
SELECT
t1
.
partition_date
,
t1
.
page_name
,
t1
.
cl_id
,
mas
.
device_
os_
type
,
mas
.
active_type
,
mas
.
channel
SELECT
t1
.
partition_date
,
t1
.
page_name
,
t1
.
cl_id
,
mas
.
device_type
,
mas
.
active_type
,
mas
.
channel
FROM
(
SELECT
partition_date
,
page_name
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'page_view'
)
t1
JOIN
(
SELECT
partition_date
,
m
.
device_id
,
device_os_type
SELECT
partition_date
,
device_os_type
as
device_type
,
m
.
device_id
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
or
first_channel_source_type
in
(
'promotion_aisi'
,
'promotion_koomobi_km00'
,
'promotion_koomobi_km01'
)
or
first_channel_source_type
like
'%longyuzhixing%'
or
first_channel_source_type
like
'%jingmeng%'
or
first_channel_source_type
like
'%mailuo%'
THEN
'可疑'
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
...
...
@@ -227,8 +230,8 @@ FROM
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
ON
m
.
device_id
=
a
.
device_id
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
where
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
active_type
in
(
'1'
,
'2'
,
'4'
)
and
first_channel_source_type
not
in
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
...
...
@@ -242,14 +245,14 @@ FROM
ON
t1
.
cl_id
=
mas
.
device_id
AND
t1
.
partition_date
=
mas
.
partition_date
LEFT
JOIN
(
(
-- 去掉疑似机构刷量的PV和UV
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
FROM
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
FROM
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
...
...
@@ -257,12 +260,12 @@ FROM
WHERE
spam_pv
.
cl_id
IS
NULL
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_
os_
type
,
t1
.
active_type
,
t2
.
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
)
T1
LEFT
JOIN
(
--不同referrer下的美购详情页pv/uv
LEFT
JOIN
(
--不同referrer下的美购详情页pv/uv
SELECT
t1
.
partition_date
,
t1
.
device_
os_
type
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
,
count
(
case
when
referrer
=
'welfare_detail'
then
t1
.
cl_id
end
)
as
wel_pv
...
...
@@ -278,29 +281,30 @@ FROM
,
count
(
case
when
referrer
=
'diary_detail'
then
t1
.
cl_id
end
)
as
diary_detail_pv
,
count
(
case
when
referrer
=
'order_detail'
then
t1
.
cl_id
end
)
as
order_detail_pv
,
count
(
case
when
referrer
=
'new_sign'
then
t1
.
cl_id
end
)
as
sign_pv
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
)
then
t1
.
cl_id
end
)
as
special_pv
--专题和大促
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
,
'custom_special'
)
then
t1
.
cl_id
end
)
as
special_pv
--专题和大促
,
count
(
case
when
referrer
=
'zone_v3'
then
t1
.
cl_id
end
)
as
zone_pv
,
count
(
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
then
t1
.
cl_id
end
)
as
ai_report_pv
--待之后增加模拟整形页面
FROM
(
SELECT
t1
.
partition_date
,
t1
.
referrer
,
t1
.
cl_id
,
mas
.
device_
os_
type
,
mas
.
active_type
,
mas
.
channel
SELECT
t1
.
partition_date
,
t1
.
referrer
,
t1
.
cl_id
,
mas
.
device_type
,
mas
.
active_type
,
mas
.
channel
FROM
(
SELECT
partition_date
,
referrer
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'page_view'
)
t1
JOIN
(
SELECT
partition_date
,
m
.
device_id
,
device_os_type
SELECT
partition_date
,
device_os_type
as
device_type
,
m
.
device_id
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
or
first_channel_source_type
in
(
'promotion_aisi'
,
'promotion_koomobi_km00'
,
'promotion_koomobi_km01'
)
or
first_channel_source_type
like
'%longyuzhixing%'
or
first_channel_source_type
like
'%jingmeng%'
or
first_channel_source_type
like
'%mailuo%'
THEN
'可疑'
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
...
...
@@ -316,8 +320,8 @@ FROM
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
ON
m
.
device_id
=
a
.
device_id
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
where
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
active_type
in
(
'1'
,
'2'
,
'4'
)
and
first_channel_source_type
not
in
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
...
...
@@ -331,14 +335,14 @@ FROM
ON
t1
.
cl_id
=
mas
.
device_id
AND
t1
.
partition_date
=
mas
.
partition_date
LEFT
JOIN
(
(
-- 去掉疑似机构刷量的PV和UV
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
FROM
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
FROM
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
...
...
@@ -346,16 +350,16 @@ FROM
WHERE
spam_pv
.
cl_id
IS
NULL
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_
os_
type
,
t1
.
active_type
,
t2
.
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
)
T2
ON
T1
.
partition_date
=
T2
.
partition_date
and
T1
.
device_os_type
=
T2
.
device_os
_type
ON
T1
.
partition_date
=
T2
.
partition_date
and
T1
.
device_type
=
T2
.
device
_type
AND
T1
.
active_type
=
T2
.
active_type
AND
T1
.
channel
=
T2
.
channel
LEFT
JOIN
(
--点击加车/支付/私信的不同来源
LEFT
JOIN
(
--点击加车/支付/私信的不同来源
SELECT
t1
.
partition_date
,
t1
.
device_
os_
type
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
,
count
(
case
when
referrer
=
'welfare_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
wel_add_pv
...
...
@@ -397,9 +401,9 @@ FROM
,
count
(
case
when
referrer
=
'new_sign'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
sign_add_pv
,
count
(
case
when
referrer
=
'new_sign'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
sign_buy_pv
,
count
(
case
when
referrer
=
'new_sign'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
sign_msg_pv
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
)
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
special_add_pv
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
)
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
special_buy_pv
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
)
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
special_msg_pv
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
,
'custom_special'
)
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
special_add_pv
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
,
'custom_special'
)
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
special_buy_pv
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
,
'custom_special'
)
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
special_msg_pv
,
count
(
case
when
referrer
=
'zone_v3'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
zone_add_pv
,
count
(
case
when
referrer
=
'zone_v3'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
zone_buy_pv
,
count
(
case
when
referrer
=
'zone_v3'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
zone_msg_pv
...
...
@@ -409,12 +413,12 @@ FROM
FROM
(
SELECT
t1
.
partition_date
,
t1
.
referrer
,
t1
.
action
,
t1
.
cl_id
,
mas
.
device_
os_
type
,
mas
.
active_type
,
mas
.
channel
SELECT
t1
.
partition_date
,
t1
.
referrer
,
t1
.
action
,
t1
.
cl_id
,
mas
.
device_type
,
mas
.
active_type
,
mas
.
channel
FROM
(
--点击加车/支付
SELECT
partition_date
,
referrer
,
action
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
in
(
'welfare_multiattribute_click_add'
,
'welfare_multiattribute_click_buy'
)
...
...
@@ -423,20 +427,42 @@ FROM
--点击私信按钮
SELECT
partition_date
,
referrer
,
action
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_message'
UNION
ALL
--点击私信区域(目前referrer缺失,故通过拆解referrer_link的方式获得)
SELECT
partition_date
,
referrer
,
action
,
cl_id
FROM
(
SELECT
partition_date
,
cl_id
,
action
,
t2
.
referrer
as
referrer
,
row_number
()
over
(
PARTITION
BY
t1
.
referrer_link
,
t1
.
cl_id
ORDER
BY
t2
.
link_id
desc
)
as
rank
from
(
SELECT
partition_date
,
params
[
'referrer_link'
]
as
referrer_link
,
cl_id
,
action
,
json_split
(
params
[
'referrer_link'
],
'string'
)
as
a
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
in
(
'question_tag'
,
'appointment'
)
)
t1
lateral
view
posexplode
(
a
)
t2
as
link_id
,
referrer
)
t3
where
rank
=
1
)
t1
JOIN
(
SELECT
partition_date
,
m
.
device_id
,
device_os_type
SELECT
partition_date
,
device_os_type
as
device_type
,
m
.
device_id
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
or
first_channel_source_type
in
(
'promotion_aisi'
,
'promotion_koomobi_km00'
,
'promotion_koomobi_km01'
)
or
first_channel_source_type
like
'%longyuzhixing%'
or
first_channel_source_type
like
'%jingmeng%'
or
first_channel_source_type
like
'%mailuo%'
THEN
'可疑'
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
...
...
@@ -452,8 +478,8 @@ FROM
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
ON
m
.
device_id
=
a
.
device_id
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
where
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
active_type
in
(
'1'
,
'2'
,
'4'
)
and
first_channel_source_type
not
in
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
...
...
@@ -469,12 +495,12 @@ FROM
LEFT
JOIN
(
-- 去掉疑似机构刷量的PV和UV
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
FROM
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
FROM
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
...
...
@@ -482,10 +508,11 @@ FROM
WHERE
spam_pv
.
cl_id
IS
NULL
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_
os_
type
,
t1
.
active_type
,
t2
.
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
)
T3
ON
T1
.
partition_date
=
T3
.
partition_date
and
T1
.
device_os_type
=
T3
.
device_os
_type
ON
T1
.
partition_date
=
T3
.
partition_date
and
T1
.
device_type
=
T3
.
device
_type
AND
T1
.
active_type
=
T3
.
active_type
AND
T1
.
channel
=
T3
.
channel
ORDER
BY
`日期`
desc
,
`设备类型`
,
`活跃类型`
,
`渠道`
sqls/meigou_detail_page/meigou_detail_page_source_uv.sql
View file @
9573f07c
--美购详情页的来源
SELECT
T1
.
partition_date
as
`日期`
,
T1
.
device_os
_type
as
`设备类型`
,
T1
.
device
_type
as
`设备类型`
,
T1
.
active_type
as
`活跃类型`
,
T1
.
channel
as
`渠道`
,
T1
.
wel_uv
as
`美购详情页uv`
...
...
@@ -13,16 +15,6 @@ SELECT T1.partition_date as `日期`
,
concat
(
round
(
T3
.
result_wel_add_uv
/
T2
.
search_result_welfare_uv
*
100
,
2
),
'%'
)
as
`搜索结果美购页-点击加车率`
,
concat
(
round
(
T3
.
result_wel_buy_uv
/
T2
.
search_result_welfare_uv
*
100
,
2
),
'%'
)
as
`搜索结果美购页-点击立即支付率`
,
concat
(
round
(
T3
.
result_wel_msg_uv
/
T2
.
search_result_welfare_uv
*
100
,
2
),
'%'
)
as
`搜索结果美购页-点击私信咨询率`
,
T1
.
welfare_list_uv
as
`美购列表页uv`
,
T2
.
welfare_list_uv
as
`美购列表页-转化uv`
,
T3
.
wel_list_add_uv
as
`美购列表页-转化点击加车uv`
,
T3
.
wel_list_buy_uv
as
`美购列表页-转化点击立即支付uv`
,
T3
.
wel_list_msg_uv
as
`美购列表页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
welfare_list_uv
/
T1
.
welfare_list_uv
*
100
,
2
),
'%'
)
as
`美购列表页-转化uv率`
,
concat
(
round
(
T2
.
welfare_list_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`美购列表页-转化美购uv占比`
,
concat
(
round
(
T3
.
wel_list_add_uv
/
T2
.
welfare_list_uv
*
100
,
2
),
'%'
)
as
`美购列表页-点击加车率`
,
concat
(
round
(
T3
.
wel_list_buy_uv
/
T2
.
welfare_list_uv
*
100
,
2
),
'%'
)
as
`美购列表页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_list_msg_uv
/
T2
.
welfare_list_uv
*
100
,
2
),
'%'
)
as
`美购列表页-点击私信咨询率`
,
T1
.
organization_detail_uv
as
`医院主页uv`
,
T2
.
organization_detail_uv
as
`医院主页-转化uv`
,
T3
.
org_add_uv
as
`医院主页-转化点击加车uv`
...
...
@@ -43,26 +35,26 @@ SELECT T1.partition_date as `日期`
,
concat
(
round
(
T3
.
category_add_uv
/
T2
.
category_uv
*
100
,
2
),
'%'
)
as
`品类聚合页-点击加车率`
,
concat
(
round
(
T3
.
category_buy_uv
/
T2
.
category_uv
*
100
,
2
),
'%'
)
as
`品类聚合页-点击立即支付率`
,
concat
(
round
(
T3
.
category_msg_uv
/
T2
.
category_uv
*
100
,
2
),
'%'
)
as
`品类聚合页-点击私信咨询率`
,
T1
.
sign_uv
as
`签到
页uv`
,
T2
.
sign_uv
as
`签到
页-转化uv`
,
T3
.
sign_add_uv
as
`签到
页-转化点击加车uv`
,
T3
.
sign_buy_uv
as
`签到
页-转化点击立即支付uv`
,
T3
.
sign_msg_uv
as
`签到
页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
sign_uv
/
T1
.
sign_uv
*
100
,
2
),
'%'
)
as
`签到
页-转化uv率`
,
concat
(
round
(
T2
.
sign_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`签到
页-转化美购uv占比`
,
concat
(
round
(
T3
.
sign_add_uv
/
T2
.
sign_uv
*
100
,
2
),
'%'
)
as
`签到
页-点击加车率`
,
concat
(
round
(
T3
.
sign_buy_uv
/
T2
.
sign_uv
*
100
,
2
),
'%'
)
as
`签到
页-点击立即支付率`
,
concat
(
round
(
T3
.
sign_msg_uv
/
T2
.
sign_uv
*
100
,
2
),
'%'
)
as
`签到
页-点击私信咨询率`
,
T1
.
special_uv
as
`专题和大促
页uv`
,
T2
.
special_uv
as
`专题和大促
页-转化uv`
,
T3
.
special_add_uv
as
`专题和大促
页-转化点击加车uv`
,
T3
.
special_buy_uv
as
`专题和大促
页-转化点击立即支付uv`
,
T3
.
special_msg_uv
as
`专题和大促
页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
special_uv
/
T1
.
special_uv
*
100
,
2
),
'%'
)
as
`专题和大促
页-转化uv率`
,
concat
(
round
(
T2
.
special_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`专题和大促
页-转化美购uv占比`
,
concat
(
round
(
T3
.
special_add_uv
/
T2
.
special_uv
*
100
,
2
),
'%'
)
as
`专题和大促
页-点击加车率`
,
concat
(
round
(
T3
.
special_buy_uv
/
T2
.
special_uv
*
100
,
2
),
'%'
)
as
`专题和大促
页-点击立即支付率`
,
concat
(
round
(
T3
.
special_msg_uv
/
T2
.
special_uv
*
100
,
2
),
'%'
)
as
`专题和大促
页-点击私信咨询率`
,
T1
.
conversation_detail_uv
as
`私信详情
页uv`
,
T2
.
conversation_detail_uv
as
`私信详情
页-转化uv`
,
T3
.
conv_add_uv
as
`私信详情
页-转化点击加车uv`
,
T3
.
conv_buy_uv
as
`私信详情
页-转化点击立即支付uv`
,
T3
.
conv_msg_uv
as
`私信详情
页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
conversation_detail_uv
/
T1
.
conversation_detail_uv
*
100
,
2
),
'%'
)
as
`私信详情
页-转化uv率`
,
concat
(
round
(
T2
.
conversation_detail_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`私信详情
页-转化美购uv占比`
,
concat
(
round
(
T3
.
conv_add_uv
/
T2
.
conversation_detail_uv
*
100
,
2
),
'%'
)
as
`私信详情
页-点击加车率`
,
concat
(
round
(
T3
.
conv_buy_uv
/
T2
.
conversation_detail_uv
*
100
,
2
),
'%'
)
as
`私信详情
页-点击立即支付率`
,
concat
(
round
(
T3
.
conv_msg_uv
/
T2
.
conversation_detail_uv
*
100
,
2
),
'%'
)
as
`私信详情
页-点击私信咨询率`
,
T1
.
welfare_list_uv
as
`美购列表
页uv`
,
T2
.
welfare_list_uv
as
`美购列表
页-转化uv`
,
T3
.
wel_list_add_uv
as
`美购列表
页-转化点击加车uv`
,
T3
.
wel_list_buy_uv
as
`美购列表
页-转化点击立即支付uv`
,
T3
.
wel_list_msg_uv
as
`美购列表
页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
welfare_list_uv
/
T1
.
welfare_list_uv
*
100
,
2
),
'%'
)
as
`美购列表
页-转化uv率`
,
concat
(
round
(
T2
.
welfare_list_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`美购列表
页-转化美购uv占比`
,
concat
(
round
(
T3
.
wel_list_add_uv
/
T2
.
welfare_list_uv
*
100
,
2
),
'%'
)
as
`美购列表
页-点击加车率`
,
concat
(
round
(
T3
.
wel_list_buy_uv
/
T2
.
welfare_list_uv
*
100
,
2
),
'%'
)
as
`美购列表
页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_list_msg_uv
/
T2
.
welfare_list_uv
*
100
,
2
),
'%'
)
as
`美购列表
页-点击私信咨询率`
,
T1
.
my_cart_uv
as
`购物车uv`
,
T2
.
my_cart_uv
as
`购物车-转化uv`
,
T3
.
cart_add_uv
as
`购物车-转化点击加车uv`
...
...
@@ -83,36 +75,6 @@ SELECT T1.partition_date as `日期`
,
concat
(
round
(
T3
.
result_more_add_uv
/
T2
.
search_result_more_uv
*
100
,
2
),
'%'
)
as
`搜索结果综合页-点击加车率`
,
concat
(
round
(
T3
.
result_more_buy_uv
/
T2
.
search_result_more_uv
*
100
,
2
),
'%'
)
as
`搜索结果综合页-点击立即支付率`
,
concat
(
round
(
T3
.
result_more_msg_uv
/
T2
.
search_result_more_uv
*
100
,
2
),
'%'
)
as
`搜索结果综合页-点击私信咨询率`
,
T1
.
welfare_home_uv
as
`美购首页uv`
,
T2
.
welfare_home_uv
as
`美购首页-转化uv`
,
T3
.
wel_home_add_uv
as
`美购首页-转化点击加车uv`
,
T3
.
wel_home_buy_uv
as
`美购首页-转化点击立即支付uv`
,
T3
.
wel_home_msg_uv
as
`美购首页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
welfare_home_uv
/
T1
.
welfare_home_uv
*
100
,
2
),
'%'
)
as
`美购首页-转化uv率`
,
concat
(
round
(
T2
.
welfare_home_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`美购首页-转化美购uv占比`
,
concat
(
round
(
T3
.
wel_home_add_uv
/
T2
.
welfare_home_uv
*
100
,
2
),
'%'
)
as
`美购首页-点击加车率`
,
concat
(
round
(
T3
.
wel_home_buy_uv
/
T2
.
welfare_home_uv
*
100
,
2
),
'%'
)
as
`美购首页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_home_msg_uv
/
T2
.
welfare_home_uv
*
100
,
2
),
'%'
)
as
`美购首页-点击私信咨询率`
,
T1
.
conversation_detail_uv
as
`私信详情页uv`
,
T2
.
conversation_detail_uv
as
`私信详情页-转化uv`
,
T3
.
conv_add_uv
as
`私信详情页-转化点击加车uv`
,
T3
.
conv_buy_uv
as
`私信详情页-转化点击立即支付uv`
,
T3
.
conv_msg_uv
as
`私信详情页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
conversation_detail_uv
/
T1
.
conversation_detail_uv
*
100
,
2
),
'%'
)
as
`私信详情页-转化uv率`
,
concat
(
round
(
T2
.
conversation_detail_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`私信详情页-转化美购uv占比`
,
concat
(
round
(
T3
.
conv_add_uv
/
T2
.
conversation_detail_uv
*
100
,
2
),
'%'
)
as
`私信详情页-点击加车率`
,
concat
(
round
(
T3
.
conv_buy_uv
/
T2
.
conversation_detail_uv
*
100
,
2
),
'%'
)
as
`私信详情页-点击立即支付率`
,
concat
(
round
(
T3
.
conv_msg_uv
/
T2
.
conversation_detail_uv
*
100
,
2
),
'%'
)
as
`私信详情页-点击私信咨询率`
,
T1
.
wel_uv
as
`美购详情页uv`
,
T2
.
wel_uv
as
`其他美购详情页-转化uv`
,
T3
.
wel_add_uv
as
`其他美购详情页-转化点击加车uv`
,
T3
.
wel_buy_uv
as
`其他美购详情页-转化点击立即支付uv`
,
T3
.
wel_msg_uv
as
`其他美购详情页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
wel_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`其他美购详情页-转化uv率`
,
concat
(
round
(
T2
.
wel_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`其他美购详情页-转化美购uv占比`
,
concat
(
round
(
T3
.
wel_add_uv
/
T2
.
wel_uv
*
100
,
2
),
'%'
)
as
`其他美购详情页-点击加车率`
,
concat
(
round
(
T3
.
wel_buy_uv
/
T2
.
wel_uv
*
100
,
2
),
'%'
)
as
`其他美购详情页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_msg_uv
/
T2
.
wel_uv
*
100
,
2
),
'%'
)
as
`其他美购详情页-点击私信咨询率`
,
T1
.
order_detail_uv
as
`订单详情页uv`
,
T2
.
order_detail_uv
as
`订单详情页-转化uv`
,
T3
.
order_add_uv
as
`订单详情页-转化点击加车uv`
...
...
@@ -123,6 +85,16 @@ SELECT T1.partition_date as `日期`
,
concat
(
round
(
T3
.
order_add_uv
/
T2
.
order_detail_uv
*
100
,
2
),
'%'
)
as
`订单详情页-点击加车率`
,
concat
(
round
(
T3
.
order_buy_uv
/
T2
.
order_detail_uv
*
100
,
2
),
'%'
)
as
`订单详情页-点击立即支付率`
,
concat
(
round
(
T3
.
order_msg_uv
/
T2
.
order_detail_uv
*
100
,
2
),
'%'
)
as
`订单详情页-点击私信咨询率`
,
T1
.
special_uv
as
`专题和大促页uv`
,
T2
.
special_uv
as
`专题和大促页-转化uv`
,
T3
.
special_add_uv
as
`专题和大促页-转化点击加车uv`
,
T3
.
special_buy_uv
as
`专题和大促页-转化点击立即支付uv`
,
T3
.
special_msg_uv
as
`专题和大促页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
special_uv
/
T1
.
special_uv
*
100
,
2
),
'%'
)
as
`专题和大促页-转化uv率`
,
concat
(
round
(
T2
.
special_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`专题和大促页-转化美购uv占比`
,
concat
(
round
(
T3
.
special_add_uv
/
T2
.
special_uv
*
100
,
2
),
'%'
)
as
`专题和大促页-点击加车率`
,
concat
(
round
(
T3
.
special_buy_uv
/
T2
.
special_uv
*
100
,
2
),
'%'
)
as
`专题和大促页-点击立即支付率`
,
concat
(
round
(
T3
.
special_msg_uv
/
T2
.
special_uv
*
100
,
2
),
'%'
)
as
`专题和大促页-点击私信咨询率`
,
T1
.
expert_detail_uv
as
`医生主页uv`
,
T2
.
expert_detail_uv
as
`医生主页-转化uv`
,
T3
.
exp_add_uv
as
`医生主页-转化点击加车uv`
...
...
@@ -133,16 +105,26 @@ SELECT T1.partition_date as `日期`
,
concat
(
round
(
T3
.
exp_add_uv
/
T2
.
expert_detail_uv
*
100
,
2
),
'%'
)
as
`医生主页-点击加车率`
,
concat
(
round
(
T3
.
exp_buy_uv
/
T2
.
expert_detail_uv
*
100
,
2
),
'%'
)
as
`医生主页-点击立即支付率`
,
concat
(
round
(
T3
.
exp_msg_uv
/
T2
.
expert_detail_uv
*
100
,
2
),
'%'
)
as
`医生主页-点击私信咨询率`
,
T1
.
ai_report_uv
as
`AI结果页uv`
,
T2
.
ai_report_uv
as
`AI结果页-转化uv`
,
T3
.
ai_add_uv
as
`AI结果页-转化点击加车uv`
,
T3
.
ai_buy_uv
as
`AI结果页-转化点击立即支付uv`
,
T3
.
ai_msg_uv
as
`AI结果页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
ai_report_uv
/
T1
.
ai_report_uv
*
100
,
2
),
'%'
)
as
`AI结果页-转化uv率`
,
concat
(
round
(
T2
.
ai_report_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`AI结果页-转化美购uv占比`
,
concat
(
round
(
T3
.
ai_add_uv
/
T2
.
ai_report_uv
*
100
,
2
),
'%'
)
as
`AI结果页-点击加车率`
,
concat
(
round
(
T3
.
ai_buy_uv
/
T2
.
ai_report_uv
*
100
,
2
),
'%'
)
as
`AI结果页-点击立即支付率`
,
concat
(
round
(
T3
.
ai_msg_uv
/
T2
.
ai_report_uv
*
100
,
2
),
'%'
)
as
`AI结果页-点击私信咨询率`
,
T1
.
wel_uv
as
`美购详情页uv`
,
T2
.
wel_uv
as
`其他美购详情页-转化uv`
,
T3
.
wel_add_uv
as
`其他美购详情页-转化点击加车uv`
,
T3
.
wel_buy_uv
as
`其他美购详情页-转化点击立即支付uv`
,
T3
.
wel_msg_uv
as
`其他美购详情页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
wel_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`其他美购详情页-转化uv率`
,
concat
(
round
(
T2
.
wel_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`其他美购详情页-转化美购uv占比`
,
concat
(
round
(
T3
.
wel_add_uv
/
T2
.
wel_uv
*
100
,
2
),
'%'
)
as
`其他美购详情页-点击加车率`
,
concat
(
round
(
T3
.
wel_buy_uv
/
T2
.
wel_uv
*
100
,
2
),
'%'
)
as
`其他美购详情页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_msg_uv
/
T2
.
wel_uv
*
100
,
2
),
'%'
)
as
`其他美购详情页-点击私信咨询率`
,
T1
.
welfare_home_uv
as
`美购首页uv`
,
T2
.
welfare_home_uv
as
`美购首页-转化uv`
,
T3
.
wel_home_add_uv
as
`美购首页-转化点击加车uv`
,
T3
.
wel_home_buy_uv
as
`美购首页-转化点击立即支付uv`
,
T3
.
wel_home_msg_uv
as
`美购首页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
welfare_home_uv
/
T1
.
welfare_home_uv
*
100
,
2
),
'%'
)
as
`美购首页-转化uv率`
,
concat
(
round
(
T2
.
welfare_home_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`美购首页-转化美购uv占比`
,
concat
(
round
(
T3
.
wel_home_add_uv
/
T2
.
welfare_home_uv
*
100
,
2
),
'%'
)
as
`美购首页-点击加车率`
,
concat
(
round
(
T3
.
wel_home_buy_uv
/
T2
.
welfare_home_uv
*
100
,
2
),
'%'
)
as
`美购首页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_home_msg_uv
/
T2
.
welfare_home_uv
*
100
,
2
),
'%'
)
as
`美购首页-点击私信咨询率`
,
T1
.
diary_detail_uv
as
`日记本详情页uv`
,
T2
.
diary_detail_uv
as
`日记本详情页-转化uv`
,
T3
.
diary_add_uv
as
`日记本详情页-转化点击加车uv`
...
...
@@ -153,6 +135,26 @@ SELECT T1.partition_date as `日期`
,
concat
(
round
(
T3
.
diary_add_uv
/
T2
.
diary_detail_uv
*
100
,
2
),
'%'
)
as
`日记本详情页-点击加车率`
,
concat
(
round
(
T3
.
diary_buy_uv
/
T2
.
diary_detail_uv
*
100
,
2
),
'%'
)
as
`日记本详情页-点击立即支付率`
,
concat
(
round
(
T3
.
diary_msg_uv
/
T2
.
diary_detail_uv
*
100
,
2
),
'%'
)
as
`日记本详情页-点击私信咨询率`
,
T1
.
sign_uv
as
`签到页uv`
,
T2
.
sign_uv
as
`签到页-转化uv`
,
T3
.
sign_add_uv
as
`签到页-转化点击加车uv`
,
T3
.
sign_buy_uv
as
`签到页-转化点击立即支付uv`
,
T3
.
sign_msg_uv
as
`签到页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
sign_uv
/
T1
.
sign_uv
*
100
,
2
),
'%'
)
as
`签到页-转化uv率`
,
concat
(
round
(
T2
.
sign_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`签到页-转化美购uv占比`
,
concat
(
round
(
T3
.
sign_add_uv
/
T2
.
sign_uv
*
100
,
2
),
'%'
)
as
`签到页-点击加车率`
,
concat
(
round
(
T3
.
sign_buy_uv
/
T2
.
sign_uv
*
100
,
2
),
'%'
)
as
`签到页-点击立即支付率`
,
concat
(
round
(
T3
.
sign_msg_uv
/
T2
.
sign_uv
*
100
,
2
),
'%'
)
as
`签到页-点击私信咨询率`
,
T1
.
ai_report_uv
as
`AI结果页uv`
,
T2
.
ai_report_uv
as
`AI结果页-转化uv`
,
T3
.
ai_add_uv
as
`AI结果页-转化点击加车uv`
,
T3
.
ai_buy_uv
as
`AI结果页-转化点击立即支付uv`
,
T3
.
ai_msg_uv
as
`AI结果页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
ai_report_uv
/
T1
.
ai_report_uv
*
100
,
2
),
'%'
)
as
`AI结果页-转化uv率`
,
concat
(
round
(
T2
.
ai_report_uv
/
T1
.
wel_uv
*
100
,
2
),
'%'
)
as
`AI结果页-转化美购uv占比`
,
concat
(
round
(
T3
.
ai_add_uv
/
T2
.
ai_report_uv
*
100
,
2
),
'%'
)
as
`AI结果页-点击加车率`
,
concat
(
round
(
T3
.
ai_buy_uv
/
T2
.
ai_report_uv
*
100
,
2
),
'%'
)
as
`AI结果页-点击立即支付率`
,
concat
(
round
(
T3
.
ai_msg_uv
/
T2
.
ai_report_uv
*
100
,
2
),
'%'
)
as
`AI结果页-点击私信咨询率`
,
T1
.
zone_uv
as
`内容聚合页uv`
,
T2
.
zone_uv
as
`内容聚合页-转化uv`
,
T3
.
zone_add_uv
as
`内容聚合页-转化点击加车uv`
...
...
@@ -165,47 +167,48 @@ SELECT T1.partition_date as `日期`
,
concat
(
round
(
T3
.
zone_msg_uv
/
T2
.
zone_uv
*
100
,
2
),
'%'
)
as
`内容聚合页-点击私信咨询率`
FROM
(
(
--能够走向美购详情页的各页面uv/uv
SELECT
t1
.
partition_date
,
t1
.
device_os
_type
,
t1
.
device
_type
,
t1
.
active_type
,
t2
.
channel
,
count
(
distinct
case
when
page_name
=
'welfare_detail'
then
t1
.
cl_id
end
)
as
wel_uv
,
count
(
distinct
case
when
page_name
=
'search_result_more'
then
t1
.
cl_id
end
)
as
search_result_more_uv
,
count
(
distinct
case
when
page_name
=
'search_result_welfare'
then
t1
.
cl_id
end
)
as
search_result_welfare_uv
,
count
(
distinct
case
when
page_name
=
'organization_detail'
then
t1
.
cl_id
end
)
as
organization_detail_uv
,
count
(
distinct
case
when
page_name
=
'expert_detail'
then
t1
.
cl_id
end
)
as
expert_detail_uv
,
count
(
distinct
case
when
page_name
=
'category'
then
t1
.
cl_id
end
)
as
category_uv
,
count
(
distinct
case
when
page_name
=
'welfare_list'
then
t1
.
cl_id
end
)
as
welfare_list_uv
,
count
(
distinct
case
when
page_name
=
'welfare_home'
then
t1
.
cl_id
end
)
as
welfare_home_uv
,
count
(
distinct
case
when
page_name
=
'conversation_detail'
then
t1
.
cl_id
end
)
as
conversation_detail_uv
,
count
(
distinct
case
when
page_name
=
'my_cart'
then
t1
.
cl_id
end
)
as
my_cart_uv
,
count
(
distinct
case
when
page_name
=
'diary_detail'
then
t1
.
cl_id
end
)
as
diary_detail_uv
,
count
(
distinct
case
when
page_name
=
'order_detail'
then
t1
.
cl_id
end
)
as
order_detail_uv
,
count
(
distinct
case
when
page_name
=
'new_sign'
then
t1
.
cl_id
end
)
as
sign_uv
,
count
(
distinct
case
when
page_name
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion
'
)
then
t1
.
cl_id
end
)
as
special_uv
--专题和大促
,
count
(
distinct
case
when
page_name
=
'zone_v3'
then
t1
.
cl_id
end
)
as
zone_uv
,
count
(
distinct
case
when
page_name
in
(
'report_result'
,
'face_detect_result'
)
then
t1
.
cl_id
end
)
as
ai_report_uv
--待之后增加模拟整形页面
,
count
(
case
when
page_name
=
'welfare_detail'
then
t1
.
cl_id
end
)
as
wel_uv
,
count
(
case
when
page_name
=
'search_result_more'
then
t1
.
cl_id
end
)
as
search_result_more_uv
,
count
(
case
when
page_name
=
'search_result_welfare'
then
t1
.
cl_id
end
)
as
search_result_welfare_uv
,
count
(
case
when
page_name
=
'organization_detail'
then
t1
.
cl_id
end
)
as
organization_detail_uv
,
count
(
case
when
page_name
=
'expert_detail'
then
t1
.
cl_id
end
)
as
expert_detail_uv
,
count
(
case
when
page_name
=
'category'
then
t1
.
cl_id
end
)
as
category_uv
,
count
(
case
when
page_name
=
'welfare_list'
then
t1
.
cl_id
end
)
as
welfare_list_uv
,
count
(
case
when
page_name
=
'welfare_home'
then
t1
.
cl_id
end
)
as
welfare_home_uv
,
count
(
case
when
page_name
=
'conversation_detail'
then
t1
.
cl_id
end
)
as
conversation_detail_uv
,
count
(
case
when
page_name
=
'my_cart'
then
t1
.
cl_id
end
)
as
my_cart_uv
,
count
(
case
when
page_name
=
'diary_detail'
then
t1
.
cl_id
end
)
as
diary_detail_uv
,
count
(
case
when
page_name
=
'order_detail'
then
t1
.
cl_id
end
)
as
order_detail_uv
,
count
(
case
when
page_name
=
'new_sign'
then
t1
.
cl_id
end
)
as
sign_uv
,
count
(
case
when
page_name
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
,
'custom_special
'
)
then
t1
.
cl_id
end
)
as
special_uv
--专题和大促
,
count
(
case
when
page_name
=
'zone_v3'
then
t1
.
cl_id
end
)
as
zone_uv
,
count
(
case
when
page_name
in
(
'report_result'
,
'face_detect_result'
)
then
t1
.
cl_id
end
)
as
ai_report_uv
--待之后增加模拟整形页面
FROM
(
SELECT
t1
.
partition_date
,
t1
.
page_name
,
t1
.
cl_id
,
mas
.
device_os
_type
,
mas
.
active_type
,
mas
.
channel
SELECT
t1
.
partition_date
,
t1
.
page_name
,
t1
.
cl_id
,
mas
.
device
_type
,
mas
.
active_type
,
mas
.
channel
FROM
(
SELECT
partition_date
,
page_name
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'page_view'
)
t1
JOIN
(
SELECT
partition_date
,
m
.
device_id
,
device_os_type
SELECT
partition_date
,
device_os_type
as
device_type
,
m
.
device_id
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
or
first_channel_source_type
in
(
'promotion_aisi'
,
'promotion_koomobi_km00'
,
'promotion_koomobi_km01'
)
or
first_channel_source_type
like
'%longyuzhixing%'
or
first_channel_source_type
like
'%jingmeng%'
or
first_channel_source_type
like
'%mailuo%'
THEN
'可疑'
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
...
...
@@ -221,8 +224,8 @@ FROM
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
ON
m
.
device_id
=
a
.
device_id
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
where
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
active_type
in
(
'1'
,
'2'
,
'4'
)
and
first_channel_source_type
not
in
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
...
...
@@ -236,14 +239,14 @@ FROM
ON
t1
.
cl_id
=
mas
.
device_id
AND
t1
.
partition_date
=
mas
.
partition_date
LEFT
JOIN
(
(
-- 去掉疑似机构刷量的pV和UV
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
FROM
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
FROM
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
...
...
@@ -251,50 +254,51 @@ FROM
WHERE
spam_pv
.
cl_id
IS
NULL
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_os
_type
,
t1
.
active_type
,
t2
.
channel
)
T1
LEFT
JOIN
(
--不同referrer下的美购详情页uv/uv
GROUP
BY
t1
.
partition_date
,
t1
.
device
_type
,
t1
.
active_type
,
t2
.
channel
)
T1
LEFT
JOIN
(
--不同referrer下的美购详情页uv/uv
SELECT
t1
.
partition_date
,
t1
.
device_
os_
type
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
,
count
(
distinct
case
when
referrer
=
'welfare_detail'
then
t1
.
cl_id
end
)
as
wel_uv
,
count
(
distinct
case
when
referrer
=
'search_result_more'
then
t1
.
cl_id
end
)
as
search_result_more_uv
,
count
(
distinct
case
when
referrer
=
'search_result_welfare'
then
t1
.
cl_id
end
)
as
search_result_welfare_uv
,
count
(
distinct
case
when
referrer
=
'organization_detail'
then
t1
.
cl_id
end
)
as
organization_detail_uv
,
count
(
distinct
case
when
referrer
=
'expert_detail'
then
t1
.
cl_id
end
)
as
expert_detail_uv
,
count
(
distinct
case
when
referrer
=
'category'
then
t1
.
cl_id
end
)
as
category_uv
,
count
(
distinct
case
when
referrer
=
'welfare_list'
then
t1
.
cl_id
end
)
as
welfare_list_uv
,
count
(
distinct
case
when
referrer
=
'welfare_home'
then
t1
.
cl_id
end
)
as
welfare_home_uv
,
count
(
distinct
case
when
referrer
=
'conversation_detail'
then
t1
.
cl_id
end
)
as
conversation_detail_uv
,
count
(
distinct
case
when
referrer
=
'my_cart'
then
t1
.
cl_id
end
)
as
my_cart_uv
,
count
(
distinct
case
when
referrer
=
'diary_detail'
then
t1
.
cl_id
end
)
as
diary_detail_uv
,
count
(
distinct
case
when
referrer
=
'order_detail'
then
t1
.
cl_id
end
)
as
order_detail_uv
,
count
(
distinct
case
when
referrer
=
'new_sign'
then
t1
.
cl_id
end
)
as
sign_uv
,
count
(
distinct
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion
'
)
then
t1
.
cl_id
end
)
as
special_uv
--专题和大促
,
count
(
distinct
case
when
referrer
=
'zone_v3'
then
t1
.
cl_id
end
)
as
zone_uv
,
count
(
distinct
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
then
t1
.
cl_id
end
)
as
ai_report_uv
--待之后增加模拟整形页面
,
count
(
case
when
referrer
=
'welfare_detail'
then
t1
.
cl_id
end
)
as
wel_uv
,
count
(
case
when
referrer
=
'search_result_more'
then
t1
.
cl_id
end
)
as
search_result_more_uv
,
count
(
case
when
referrer
=
'search_result_welfare'
then
t1
.
cl_id
end
)
as
search_result_welfare_uv
,
count
(
case
when
referrer
=
'organization_detail'
then
t1
.
cl_id
end
)
as
organization_detail_uv
,
count
(
case
when
referrer
=
'expert_detail'
then
t1
.
cl_id
end
)
as
expert_detail_uv
,
count
(
case
when
referrer
=
'category'
then
t1
.
cl_id
end
)
as
category_uv
,
count
(
case
when
referrer
=
'welfare_list'
then
t1
.
cl_id
end
)
as
welfare_list_uv
,
count
(
case
when
referrer
=
'welfare_home'
then
t1
.
cl_id
end
)
as
welfare_home_uv
,
count
(
case
when
referrer
=
'conversation_detail'
then
t1
.
cl_id
end
)
as
conversation_detail_uv
,
count
(
case
when
referrer
=
'my_cart'
then
t1
.
cl_id
end
)
as
my_cart_uv
,
count
(
case
when
referrer
=
'diary_detail'
then
t1
.
cl_id
end
)
as
diary_detail_uv
,
count
(
case
when
referrer
=
'order_detail'
then
t1
.
cl_id
end
)
as
order_detail_uv
,
count
(
case
when
referrer
=
'new_sign'
then
t1
.
cl_id
end
)
as
sign_uv
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
,
'custom_special
'
)
then
t1
.
cl_id
end
)
as
special_uv
--专题和大促
,
count
(
case
when
referrer
=
'zone_v3'
then
t1
.
cl_id
end
)
as
zone_uv
,
count
(
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
then
t1
.
cl_id
end
)
as
ai_report_uv
--待之后增加模拟整形页面
FROM
(
SELECT
t1
.
partition_date
,
t1
.
referrer
,
t1
.
cl_id
,
mas
.
device_
os_
type
,
mas
.
active_type
,
mas
.
channel
SELECT
t1
.
partition_date
,
t1
.
referrer
,
t1
.
cl_id
,
mas
.
device_type
,
mas
.
active_type
,
mas
.
channel
FROM
(
SELECT
partition_date
,
referrer
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'page_view'
)
t1
JOIN
(
SELECT
partition_date
,
m
.
device_id
,
device_os_type
SELECT
partition_date
,
device_os_type
as
device_type
,
m
.
device_id
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
or
first_channel_source_type
in
(
'promotion_aisi'
,
'promotion_koomobi_km00'
,
'promotion_koomobi_km01'
)
or
first_channel_source_type
like
'%longyuzhixing%'
or
first_channel_source_type
like
'%jingmeng%'
or
first_channel_source_type
like
'%mailuo%'
THEN
'可疑'
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
...
...
@@ -310,8 +314,8 @@ FROM
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
ON
m
.
device_id
=
a
.
device_id
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
where
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
active_type
in
(
'1'
,
'2'
,
'4'
)
and
first_channel_source_type
not
in
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
...
...
@@ -325,14 +329,14 @@ FROM
ON
t1
.
cl_id
=
mas
.
device_id
AND
t1
.
partition_date
=
mas
.
partition_date
LEFT
JOIN
(
-- 去掉疑似机构刷量的
P
V和UV
(
-- 去掉疑似机构刷量的
p
V和UV
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
FROM
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
FROM
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
...
...
@@ -340,75 +344,75 @@ FROM
WHERE
spam_pv
.
cl_id
IS
NULL
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_
os_
type
,
t1
.
active_type
,
t2
.
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
)
T2
ON
T1
.
partition_date
=
T2
.
partition_date
and
T1
.
device_os_type
=
T2
.
device_os
_type
ON
T1
.
partition_date
=
T2
.
partition_date
and
T1
.
device_type
=
T2
.
device
_type
AND
T1
.
active_type
=
T2
.
active_type
AND
T1
.
channel
=
T2
.
channel
LEFT
JOIN
(
--点击加车/支付/私信的不同来源
LEFT
JOIN
(
--点击加车/支付/私信的不同来源
SELECT
t1
.
partition_date
,
t1
.
device_
os_
type
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
,
count
(
distinct
case
when
referrer
=
'welfare_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
wel_add_uv
,
count
(
distinct
case
when
referrer
=
'welfare_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
wel_buy_uv
,
count
(
distinct
case
when
referrer
=
'welfare_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
wel_msg_uv
,
count
(
distinct
case
when
referrer
=
'search_result_more'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
result_more_add_uv
,
count
(
distinct
case
when
referrer
=
'search_result_more'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
result_more_buy_uv
,
count
(
distinct
case
when
referrer
=
'search_result_more'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
result_more_msg_uv
,
count
(
distinct
case
when
referrer
=
'search_result_welfare'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
result_wel_add_uv
,
count
(
distinct
case
when
referrer
=
'search_result_welfare'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
result_wel_buy_uv
,
count
(
distinct
case
when
referrer
=
'search_result_welfare'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
result_wel_msg_uv
,
count
(
distinct
case
when
referrer
=
'organization_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
org_add_uv
,
count
(
distinct
case
when
referrer
=
'organization_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
org_buy_uv
,
count
(
distinct
case
when
referrer
=
'organization_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
org_msg_uv
,
count
(
distinct
case
when
referrer
=
'expert_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
exp_add_uv
,
count
(
distinct
case
when
referrer
=
'expert_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
exp_buy_uv
,
count
(
distinct
case
when
referrer
=
'expert_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
exp_msg_uv
,
count
(
distinct
case
when
referrer
=
'category'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
category_add_uv
,
count
(
distinct
case
when
referrer
=
'category'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
category_buy_uv
,
count
(
distinct
case
when
referrer
=
'category'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
category_msg_uv
,
count
(
distinct
case
when
referrer
=
'welfare_list'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
wel_list_add_uv
,
count
(
distinct
case
when
referrer
=
'welfare_list'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
wel_list_buy_uv
,
count
(
distinct
case
when
referrer
=
'welfare_list'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
wel_list_msg_uv
,
count
(
distinct
case
when
referrer
=
'welfare_home'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
wel_home_add_uv
,
count
(
distinct
case
when
referrer
=
'welfare_home'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
wel_home_buy_uv
,
count
(
distinct
case
when
referrer
=
'welfare_home'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
wel_home_msg_uv
,
count
(
distinct
case
when
referrer
=
'conversation_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
conv_add_uv
,
count
(
distinct
case
when
referrer
=
'conversation_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
conv_buy_uv
,
count
(
distinct
case
when
referrer
=
'conversation_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
conv_msg_uv
,
count
(
distinct
case
when
referrer
=
'my_cart'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
cart_add_uv
,
count
(
distinct
case
when
referrer
=
'my_cart'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
cart_buy_uv
,
count
(
distinct
case
when
referrer
=
'my_cart'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
cart_msg_uv
,
count
(
distinct
case
when
referrer
=
'diary_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
diary_add_uv
,
count
(
distinct
case
when
referrer
=
'diary_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
diary_buy_uv
,
count
(
distinct
case
when
referrer
=
'diary_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
diary_msg_uv
,
count
(
distinct
case
when
referrer
=
'order_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
order_add_uv
,
count
(
distinct
case
when
referrer
=
'order_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
order_buy_uv
,
count
(
distinct
case
when
referrer
=
'order_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
order_msg_uv
,
count
(
distinct
case
when
referrer
=
'new_sign'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
sign_add_uv
,
count
(
distinct
case
when
referrer
=
'new_sign'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
sign_buy_uv
,
count
(
distinct
case
when
referrer
=
'new_sign'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
sign_msg_uv
,
count
(
distinct
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion
'
)
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
special_add_uv
,
count
(
distinct
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion
'
)
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
special_buy_uv
,
count
(
distinct
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion
'
)
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
special_msg_uv
,
count
(
distinct
case
when
referrer
=
'zone_v3'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
zone_add_uv
,
count
(
distinct
case
when
referrer
=
'zone_v3'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
zone_buy_uv
,
count
(
distinct
case
when
referrer
=
'zone_v3'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
zone_msg_uv
,
count
(
distinct
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
ai_add_uv
,
count
(
distinct
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
ai_buy_uv
,
count
(
distinct
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
ai_msg_uv
,
count
(
case
when
referrer
=
'welfare_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
wel_add_uv
,
count
(
case
when
referrer
=
'welfare_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
wel_buy_uv
,
count
(
case
when
referrer
=
'welfare_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
wel_msg_uv
,
count
(
case
when
referrer
=
'search_result_more'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
result_more_add_uv
,
count
(
case
when
referrer
=
'search_result_more'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
result_more_buy_uv
,
count
(
case
when
referrer
=
'search_result_more'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
result_more_msg_uv
,
count
(
case
when
referrer
=
'search_result_welfare'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
result_wel_add_uv
,
count
(
case
when
referrer
=
'search_result_welfare'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
result_wel_buy_uv
,
count
(
case
when
referrer
=
'search_result_welfare'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
result_wel_msg_uv
,
count
(
case
when
referrer
=
'organization_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
org_add_uv
,
count
(
case
when
referrer
=
'organization_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
org_buy_uv
,
count
(
case
when
referrer
=
'organization_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
org_msg_uv
,
count
(
case
when
referrer
=
'expert_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
exp_add_uv
,
count
(
case
when
referrer
=
'expert_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
exp_buy_uv
,
count
(
case
when
referrer
=
'expert_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
exp_msg_uv
,
count
(
case
when
referrer
=
'category'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
category_add_uv
,
count
(
case
when
referrer
=
'category'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
category_buy_uv
,
count
(
case
when
referrer
=
'category'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
category_msg_uv
,
count
(
case
when
referrer
=
'welfare_list'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
wel_list_add_uv
,
count
(
case
when
referrer
=
'welfare_list'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
wel_list_buy_uv
,
count
(
case
when
referrer
=
'welfare_list'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
wel_list_msg_uv
,
count
(
case
when
referrer
=
'welfare_home'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
wel_home_add_uv
,
count
(
case
when
referrer
=
'welfare_home'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
wel_home_buy_uv
,
count
(
case
when
referrer
=
'welfare_home'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
wel_home_msg_uv
,
count
(
case
when
referrer
=
'conversation_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
conv_add_uv
,
count
(
case
when
referrer
=
'conversation_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
conv_buy_uv
,
count
(
case
when
referrer
=
'conversation_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
conv_msg_uv
,
count
(
case
when
referrer
=
'my_cart'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
cart_add_uv
,
count
(
case
when
referrer
=
'my_cart'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
cart_buy_uv
,
count
(
case
when
referrer
=
'my_cart'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
cart_msg_uv
,
count
(
case
when
referrer
=
'diary_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
diary_add_uv
,
count
(
case
when
referrer
=
'diary_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
diary_buy_uv
,
count
(
case
when
referrer
=
'diary_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
diary_msg_uv
,
count
(
case
when
referrer
=
'order_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
order_add_uv
,
count
(
case
when
referrer
=
'order_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
order_buy_uv
,
count
(
case
when
referrer
=
'order_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
order_msg_uv
,
count
(
case
when
referrer
=
'new_sign'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
sign_add_uv
,
count
(
case
when
referrer
=
'new_sign'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
sign_buy_uv
,
count
(
case
when
referrer
=
'new_sign'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
sign_msg_uv
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
,
'custom_special
'
)
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
special_add_uv
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
,
'custom_special
'
)
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
special_buy_uv
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
,
'custom_special
'
)
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
special_msg_uv
,
count
(
case
when
referrer
=
'zone_v3'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
zone_add_uv
,
count
(
case
when
referrer
=
'zone_v3'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
zone_buy_uv
,
count
(
case
when
referrer
=
'zone_v3'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
zone_msg_uv
,
count
(
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
ai_add_uv
,
count
(
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
ai_buy_uv
,
count
(
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
ai_msg_uv
FROM
(
SELECT
t1
.
partition_date
,
t1
.
referrer
,
t1
.
action
,
t1
.
cl_id
,
mas
.
device_
os_
type
,
mas
.
active_type
,
mas
.
channel
SELECT
t1
.
partition_date
,
t1
.
referrer
,
t1
.
action
,
t1
.
cl_id
,
mas
.
device_type
,
mas
.
active_type
,
mas
.
channel
FROM
(
--点击加车/支付
SELECT
partition_date
,
referrer
,
action
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
in
(
'welfare_multiattribute_click_add'
,
'welfare_multiattribute_click_buy'
)
...
...
@@ -417,19 +421,42 @@ FROM
--点击私信按钮
SELECT
partition_date
,
referrer
,
action
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
(
(
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_message'
UNION
ALL
--点击私信区域(目前referrer缺失,故通过拆解referrer_link的方式获得)
SELECT
partition_date
,
referrer
,
action
,
cl_id
FROM
(
SELECT
partition_date
,
cl_id
,
action
,
t2
.
referrer
as
referrer
,
row_number
()
over
(
PARTITION
BY
t1
.
referrer_link
,
t1
.
cl_id
ORDER
BY
t2
.
link_id
desc
)
as
rank
from
(
SELECT
partition_date
,
params
[
'referrer_link'
]
as
referrer_link
,
cl_id
,
action
,
json_split
(
params
[
'referrer_link'
],
'string'
)
as
a
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
in
(
'question_tag'
,
'appointment'
)
)
t1
lateral
view
posexplode
(
a
)
t2
as
link_id
,
referrer
)
t3
where
rank
=
1
)
t1
JOIN
(
SELECT
partition_date
,
m
.
device_id
,
device_os_type
SELECT
partition_date
,
device_os_type
as
device_type
,
m
.
device_id
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
or
first_channel_source_type
in
(
'promotion_aisi'
,
'promotion_koomobi_km00'
,
'promotion_koomobi_km01'
)
or
first_channel_source_type
like
'%longyuzhixing%'
or
first_channel_source_type
like
'%jingmeng%'
or
first_channel_source_type
like
'%mailuo%'
THEN
'可疑'
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
...
...
@@ -445,8 +472,8 @@ FROM
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
ON
m
.
device_id
=
a
.
device_id
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
90
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
where
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
)
,
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
active_type
in
(
'1'
,
'2'
,
'4'
)
and
first_channel_source_type
not
in
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
...
...
@@ -462,12 +489,12 @@ FROM
LEFT
JOIN
(
-- 去掉疑似机构刷量的PV和UV
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
FROM
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
FROM
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
...
...
@@ -475,10 +502,11 @@ FROM
WHERE
spam_pv
.
cl_id
IS
NULL
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_
os_
type
,
t1
.
active_type
,
t2
.
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
)
T3
ON
T1
.
partition_date
=
T3
.
partition_date
and
T1
.
device_os_type
=
T3
.
device_os
_type
ON
T1
.
partition_date
=
T3
.
partition_date
and
T1
.
device_type
=
T3
.
device
_type
AND
T1
.
active_type
=
T3
.
active_type
AND
T1
.
channel
=
T3
.
channel
ORDER
BY
`日期`
desc
,
`设备类型`
,
`活跃类型`
,
`渠道`
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment