|
@@ -23,10 +23,9 @@ class AppBytedanceCompanyUserReportBusi:
|
|
try:
|
|
try:
|
|
sql = """
|
|
sql = """
|
|
SET sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
|
|
SET sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
|
|
-REPLACE INTO application.app_bytedance_company_user_report_busi_{day_count}d SELECT
|
|
|
|
-concat(
|
|
|
|
-date_format(
|
|
|
|
-date_sub({date_time}, INTERVAL ({day_count} -1 ) DAY),'%Y%m%d'),'-',{date_time}) start_end_time,
|
|
|
|
|
|
+REPLACE INTO application.app_bytedance_company_user_report_busi_{day_count}d
|
|
|
|
+SELECT
|
|
|
|
+concat(date_format(date_sub({date_time}, INTERVAL ({day_count} -1 ) DAY),'%Y%m%d'),'-',{date_time}) start_end_time,
|
|
ifnull(company_id,'-') company_id,
|
|
ifnull(company_id,'-') company_id,
|
|
company_name,
|
|
company_name,
|
|
org_code,
|
|
org_code,
|
|
@@ -38,12 +37,12 @@ date_sub({date_time}, INTERVAL ({day_count} -1 ) DAY),'%Y%m%d'),'-',{date_time}
|
|
count(DISTINCT account_id),
|
|
count(DISTINCT account_id),
|
|
sum(cost) cost,
|
|
sum(cost) cost,
|
|
sum(`show`) `show`,
|
|
sum(`show`) `show`,
|
|
- ifnull(round(sum(cost) / sum(`show`), 3) avg_show_cost,
|
|
|
|
|
|
+ ifnull(round(sum(cost) / sum(`show`), 3),0) avg_show_cost,
|
|
sum(click) click,
|
|
sum(click) click,
|
|
- ifnull(round(sum(cost) / sum(`click`), 3) avg_click_cost,
|
|
|
|
|
|
+ ifnull(round(sum(cost) / sum(`click`), 3),0) avg_click_cost,
|
|
ifnull(round(sum(click) / sum(`show`) * 100,3),0) ctr,
|
|
ifnull(round(sum(click) / sum(`show`) * 100,3),0) ctr,
|
|
sum(`convert`) `convert`,
|
|
sum(`convert`) `convert`,
|
|
- ifnull(round(sum(cost) / sum(`convert`), 3) convert_cost,
|
|
|
|
|
|
+ ifnull(round(sum(cost) / sum(`convert`), 3),0) convert_cost,
|
|
ifnull(round(sum(`convert`) / sum(click) * 100,3),0) convert_rate,
|
|
ifnull(round(sum(`convert`) / sum(click) * 100,3),0) convert_rate,
|
|
sum(deep_convert) deep_convert,
|
|
sum(deep_convert) deep_convert,
|
|
ifnull(round(sum(cost) / sum(deep_convert),3),0) deep_convert_cost,
|
|
ifnull(round(sum(cost) / sum(deep_convert),3),0) deep_convert_cost,
|
|
@@ -63,11 +62,11 @@ date_sub({date_time}, INTERVAL ({day_count} -1 ) DAY),'%Y%m%d'),'-',{date_time}
|
|
ifnull(round(sum(cost) / sum(install_finish),3),0) install_finish_cost,
|
|
ifnull(round(sum(cost) / sum(install_finish),3),0) install_finish_cost,
|
|
ifnull(round(sum(install_finish) / sum(download_finish) * 100,3),0) install_finish_rate,
|
|
ifnull(round(sum(install_finish) / sum(download_finish) * 100,3),0) install_finish_rate,
|
|
sum(active) active,
|
|
sum(active) active,
|
|
- ifnull(round(sum(cost) / sum(active), 3) active_cost,
|
|
|
|
|
|
+ ifnull(round(sum(cost) / sum(active), 3),0) active_cost,
|
|
ifnull(round(sum(active) / sum(click) * 100,3),0) active_rate,
|
|
ifnull(round(sum(active) / sum(click) * 100,3),0) active_rate,
|
|
sum(register) register,
|
|
sum(register) register,
|
|
- ifnull(round(sum(cost) / sum(register), 3) active_register_cost,
|
|
|
|
- ifnull(round(sum(active_register_rate)/ {day_count} * 100,3),0) active_register_rate,
|
|
|
|
|
|
+ ifnull(round(sum(cost) / sum(register), 3),0) active_register_cost,
|
|
|
|
+ ifnull(round(sum(active_register_rate)/{day_count} * 100,3),0) active_register_rate,
|
|
sum(next_day_open) next_day_open,
|
|
sum(next_day_open) next_day_open,
|
|
ifnull(round(sum(cost) / sum(next_day_open),3),0) next_day_open_cost,
|
|
ifnull(round(sum(cost) / sum(next_day_open),3),0) next_day_open_cost,
|
|
ifnull(round(sum(next_day_open) / sum(active) * 100,3),0) next_day_open_rate,
|
|
ifnull(round(sum(next_day_open) / sum(active) * 100,3),0) next_day_open_rate,
|
|
@@ -76,14 +75,14 @@ date_sub({date_time}, INTERVAL ({day_count} -1 ) DAY),'%Y%m%d'),'-',{date_time}
|
|
ifnull(round(sum(attribution_next_day_open_cnt) / sum(active) * 100,3),0) attribution_next_day_open_rate,
|
|
ifnull(round(sum(attribution_next_day_open_cnt) / sum(active) * 100,3),0) attribution_next_day_open_rate,
|
|
sum(game_addiction) game_addiction,
|
|
sum(game_addiction) game_addiction,
|
|
ifnull(round(sum(cost) / sum(game_addiction),3),0) game_addiction_cost,
|
|
ifnull(round(sum(cost) / sum(game_addiction),3),0) game_addiction_cost,
|
|
- ifnull(round(sum(game_addiction_rate)/ {day_count} * 100,3),0) game_addiction_rate,
|
|
|
|
|
|
+ ifnull(round(sum(game_addiction_rate)/{day_count} * 100,3),0) game_addiction_rate,
|
|
sum(pay_count) pay_count,
|
|
sum(pay_count) pay_count,
|
|
- ifnull(round(sum(cost) / sum(pay_count), 3) active_pay_cost,
|
|
|
|
|
|
+ ifnull(round(sum(cost) / sum(pay_count), 3),0) active_pay_cost,
|
|
ifnull(round(sum(pay_count) / sum(active) * 100,3),0) active_pay_rate,
|
|
ifnull(round(sum(pay_count) / sum(active) * 100,3),0) active_pay_rate,
|
|
sum(loan_completion) loan_completion,
|
|
sum(loan_completion) loan_completion,
|
|
ifnull(round(sum(cost) / sum(loan_completion),3),0) loan_completion_cost,
|
|
ifnull(round(sum(cost) / sum(loan_completion),3),0) loan_completion_cost,
|
|
ifnull(round(sum(loan_completion) / sum(register) * 100,3),0) loan_completion_rate,
|
|
ifnull(round(sum(loan_completion) / sum(register) * 100,3),0) loan_completion_rate,
|
|
- ifnull(round(sum(pre_loan_credit), 3) pre_loan_credit,
|
|
|
|
|
|
+ ifnull(round(sum(pre_loan_credit), 3),0) pre_loan_credit,
|
|
ifnull(round(sum(cost) / sum(pre_loan_credit),3),0) pre_loan_credit_cost,
|
|
ifnull(round(sum(cost) / sum(pre_loan_credit),3),0) pre_loan_credit_cost,
|
|
sum(loan_credit) loan_credit,
|
|
sum(loan_credit) loan_credit,
|
|
ifnull(round(sum(cost) / sum(loan_credit),3),0) loan_credit_cost,
|
|
ifnull(round(sum(cost) / sum(loan_credit),3),0) loan_credit_cost,
|
|
@@ -93,9 +92,9 @@ date_sub({date_time}, INTERVAL ({day_count} -1 ) DAY),'%Y%m%d'),'-',{date_time}
|
|
sum(in_app_cart) in_app_cart,
|
|
sum(in_app_cart) in_app_cart,
|
|
sum(in_app_pay) in_app_pay,
|
|
sum(in_app_pay) in_app_pay,
|
|
sum(in_app_order) in_app_order,
|
|
sum(in_app_order) in_app_order,
|
|
- ifnull(round(sum(attribution_game_pay_7d_count)/ {day_count},3),0) attribution_game_pay_7d_count,
|
|
|
|
- ifnull(round(sum(attribution_game_pay_7d_cost)/ {day_count},3),0) attribution_game_pay_7d_cost,
|
|
|
|
- ifnull(round(sum(attribution_active_pay_7d_per_count)/ {day_count},3),0) attribution_active_pay_7d_per_count,
|
|
|
|
|
|
+ ifnull(round(sum(attribution_game_pay_7d_count)/{day_count},3),0) attribution_game_pay_7d_count,
|
|
|
|
+ ifnull(round(sum(attribution_game_pay_7d_cost)/{day_count},3),0) attribution_game_pay_7d_cost,
|
|
|
|
+ ifnull(round(sum(attribution_active_pay_7d_per_count)/{day_count},3),0) attribution_active_pay_7d_per_count,
|
|
sum(game_pay_cost) game_pay_cost,
|
|
sum(game_pay_cost) game_pay_cost,
|
|
sum(game_pay_count) game_pay_count,
|
|
sum(game_pay_count) game_pay_count,
|
|
sum(phone) phone,
|
|
sum(phone) phone,
|
|
@@ -137,7 +136,7 @@ date_sub({date_time}, INTERVAL ({day_count} -1 ) DAY),'%Y%m%d'),'-',{date_time}
|
|
sum(luban_live_pay_order_stat_cost) luban_live_pay_order_stat_cost,
|
|
sum(luban_live_pay_order_stat_cost) luban_live_pay_order_stat_cost,
|
|
sum(live_component_click_count) live_component_click_count,
|
|
sum(live_component_click_count) live_component_click_count,
|
|
ifnull(round(sum(cost) / sum(live_component_click_count),3),0) live_component_click_cost,
|
|
ifnull(round(sum(cost) / sum(live_component_click_count),3),0) live_component_click_cost,
|
|
- ifnull(round(sum(live_component_click_count)/ {day_count} * 100,3),0) live_component_click_rate,
|
|
|
|
|
|
+ ifnull(round(sum(live_component_click_count)/{day_count} * 100,3),0) live_component_click_rate,
|
|
sum(wechat_login_count) wechat_login_count,
|
|
sum(wechat_login_count) wechat_login_count,
|
|
sum(attribution_wechat_login_30d_count) attribution_wechat_login_30d_count,
|
|
sum(attribution_wechat_login_30d_count) attribution_wechat_login_30d_count,
|
|
ifnull(round(sum(cost) / sum(wechat_login_count),3),0) wechat_login_cost,
|
|
ifnull(round(sum(cost) / sum(wechat_login_count),3),0) wechat_login_cost,
|
|
@@ -160,11 +159,11 @@ date_sub({date_time}, INTERVAL ({day_count} -1 ) DAY),'%Y%m%d'),'-',{date_time}
|
|
sum(play_50_feed_break) play_50_feed_break,
|
|
sum(play_50_feed_break) play_50_feed_break,
|
|
sum(play_75_feed_break) play_75_feed_break,
|
|
sum(play_75_feed_break) play_75_feed_break,
|
|
sum(play_100_feed_break) play_100_feed_break,
|
|
sum(play_100_feed_break) play_100_feed_break,
|
|
- ifnull(round(sum(average_play_time_per_play)/ {day_count},3),0) average_play_time_per_play,
|
|
|
|
- ifnull(round(sum(play_over_rate)/ {day_count} * 100,3),0) play_over_rate,
|
|
|
|
|
|
+ ifnull(round(sum(average_play_time_per_play)/{day_count},3),0) average_play_time_per_play,
|
|
|
|
+ ifnull(round(sum(play_over_rate)/{day_count} * 100,3),0) play_over_rate,
|
|
ifnull(round(sum(wifi_play) / sum(total_play) * 100,3),0) wifi_play_rate,
|
|
ifnull(round(sum(wifi_play) / sum(total_play) * 100,3),0) wifi_play_rate,
|
|
sum(wifi_play) wifi_play,
|
|
sum(wifi_play) wifi_play,
|
|
- ifnull(round(sum(play_duration_sum)/ {day_count}, 3) play_duration_sum,
|
|
|
|
|
|
+ ifnull(round(sum(play_duration_sum)/{day_count}, 3),0) play_duration_sum,
|
|
sum(advanced_creative_phone_click) advanced_creative_phone_click,
|
|
sum(advanced_creative_phone_click) advanced_creative_phone_click,
|
|
sum(advanced_creative_counsel_click) advanced_creative_counsel_click,
|
|
sum(advanced_creative_counsel_click) advanced_creative_counsel_click,
|
|
sum(advanced_creative_form_click) advanced_creative_form_click,
|
|
sum(advanced_creative_form_click) advanced_creative_form_click,
|