Index: trunk/fundraiser-statistics/fundraiser-scripts/sql/report_LP_metrics_minutely.sql |
— | — | @@ -18,9 +18,10 @@ |
19 | 19 | DATE_FORMAT(request_time,'%sY%sm%sd%sH') as dt_hr, |
20 | 20 | FLOOR(MINUTE(request_time) / %s) * %s as dt_min, |
21 | 21 | landing_page, |
22 | | -count(*) as views |
| 22 | +count(*) as views, |
| 23 | +utm_campaign |
23 | 24 | |
24 | | -from landing_page |
| 25 | +from landing_page_requests |
25 | 26 | |
26 | 27 | where request_time >= '%s' and request_time < '%s' |
27 | 28 | and utm_campaign REGEXP '%s' |
— | — | @@ -45,6 +46,7 @@ |
46 | 47 | |
47 | 48 | on ecomm.landing_page = lp.landing_page and ecomm.hr = lp.dt_hr and ecomm.dt_min = lp.dt_min |
48 | 49 | |
| 50 | +where lp.utm_campaign REGEXP '%s' |
49 | 51 | group by 1,2 |
50 | 52 | -- having views > 1000 and donations > 10 |
51 | 53 | order by 1 asc; |
Index: trunk/fundraiser-statistics/fundraiser-scripts/sql/report_banner_metrics_minutely.sql |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | select |
5 | 5 | |
6 | 6 | if(imp.dt_min < 10, concat(imp.dt_hr, '0', imp.dt_min,'00'), concat(imp.dt_hr, imp.dt_min,'00')) as day_hr, |
7 | | -lp.utm_source, |
| 7 | +imp.utm_source, |
8 | 8 | floor(impressions * (views / total_views)) as impressions, |
9 | 9 | views, |
10 | 10 | -- total_clicks, |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | FLOOR(MINUTE(on_minute) / %s) * %s as dt_min, |
25 | 25 | utm_source, |
26 | 26 | sum(counts) as impressions |
27 | | -from impression |
| 27 | +from banner_impressions |
28 | 28 | where on_minute > '%s' and on_minute < '%s' |
29 | 29 | group by 1,2,3) as imp |
30 | 30 | |
— | — | @@ -33,8 +33,9 @@ |
34 | 34 | DATE_FORMAT(request_time,'%sY%sm%sd%sH') as dt_hr, |
35 | 35 | FLOOR(MINUTE(request_time) / %s) * %s as dt_min, |
36 | 36 | utm_source, |
37 | | -count(*) as views |
38 | | -from landing_page |
| 37 | +count(*) as views, |
| 38 | +utm_campaign |
| 39 | +from landing_page_requests |
39 | 40 | where request_time >= '%s' and request_time < '%s' |
40 | 41 | and utm_campaign REGEXP '%s' |
41 | 42 | group by 1,2,3) as lp |
— | — | @@ -48,13 +49,13 @@ |
49 | 50 | FLOOR(MINUTE(request_time) / %s) * %s as dt_min, |
50 | 51 | utm_source, |
51 | 52 | count(*) as total_views |
52 | | -from landing_page |
| 53 | +from landing_page_requests |
53 | 54 | where request_time >= '%s' and request_time < '%s' |
54 | 55 | group by 1,2,3) as lp_tot |
55 | 56 | |
56 | 57 | on imp.utm_source = lp_tot.utm_source and imp.dt_hr = lp_tot.dt_hr and imp.dt_min = lp_tot.dt_min |
57 | 58 | |
58 | | -join |
| 59 | +left join |
59 | 60 | |
60 | 61 | (select |
61 | 62 | DATE_FORMAT(receive_date,'%sY%sm%sd%sH') as hr, |
— | — | @@ -73,6 +74,7 @@ |
74 | 75 | |
75 | 76 | on ecomm.banner = lp.utm_source and ecomm.hr = lp.dt_hr and ecomm.dt_min = lp.dt_min |
76 | 77 | |
| 78 | +where lp.utm_campaign REGEXP '%s' |
77 | 79 | group by 1,2 |
78 | 80 | -- having impressions > 100000 and donations > 10 |
79 | 81 | order by 1 asc; |