Index: trunk/fundraiser-statistics/fundraiser-scripts/fundraiser_reporting.py |
— | — | @@ -507,6 +507,10 @@ |
508 | 508 | query_name = 'report_LP_metrics' |
509 | 509 | elif type == 'BAN': |
510 | 510 | query_name = 'report_banner_metrics' |
| 511 | + elif type == 'BAN-TEST': |
| 512 | + '[0-9](JA|SA|EA)[0-9]' |
| 513 | + elif type == 'LP-TEST': |
| 514 | + '[0-9](JA|SA|EA)[0-9]' |
511 | 515 | else: |
512 | 516 | sys.exit("Invalid type name - must be 'LP' or 'BAN'.") |
513 | 517 | |
— | — | @@ -524,4 +528,24 @@ |
525 | 529 | self.gen_plot(metrics, times, title, xlabel, ylabel, ranges, subplot_index, query_name + '_' + metric_name + '.png') |
526 | 530 | |
527 | 531 | return [metrics, times] |
528 | | - |
\ No newline at end of file |
| 532 | + |
| 533 | + |
| 534 | +""" |
| 535 | + |
| 536 | +CLASS :: ^TestReporting^ |
| 537 | + |
| 538 | +This subclass handles reporting on specific tests as defined by a utm campaign. |
| 539 | + |
| 540 | +""" |
| 541 | + |
| 542 | +class TestReporting(FundraiserReporting): |
| 543 | + |
| 544 | + def run_query(self,start_time, end_time, query_name, metric_name): |
| 545 | + 'report_latest_campaign' |
| 546 | + # select the first row |
| 547 | + |
| 548 | + |
| 549 | + def gen_plot(self,counts, times, title, xlabel, ylabel, ranges, subplot_index, fname): |
| 550 | + |
| 551 | + def run(self, type, metric_name): |
| 552 | + |
\ No newline at end of file |
Index: trunk/fundraiser-statistics/fundraiser-scripts/sql/report_banner_metrics.sql |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | count(*) as views |
39 | 39 | from landing_page |
40 | 40 | where request_time >= '%s' and request_time < '%s' |
41 | | -and utm_campaign REGEXP 'JA' |
| 41 | +and utm_campaign REGEXP '%s' |
42 | 42 | group by 1,2) as lp |
43 | 43 | |
44 | 44 | on imp.utm_source = lp.utm_source and imp.hr = lp.hr |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | drupal.contribution_tracking LEFT JOIN civicrm.public_reporting |
59 | 59 | ON (contribution_tracking.contribution_id = civicrm.public_reporting.contribution_id) |
60 | 60 | where ts >= '%s' and ts < '%s' |
61 | | -and utm_campaign REGEXP 'JA' |
| 61 | +and utm_campaign REGEXP '%s' |
62 | 62 | group by 1,2) as ecomm |
63 | 63 | |
64 | 64 | on ecomm.banner = lp.utm_source and ecomm.hr = lp.hr |
Index: trunk/fundraiser-statistics/fundraiser-scripts/sql/report_LP_metrics.sql |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | from landing_page |
35 | 35 | |
36 | 36 | where request_time >= '%s' and request_time < '%s' |
37 | | -and utm_campaign REGEXP 'JA' |
| 37 | +and utm_campaign REGEXP '%s' |
38 | 38 | group by 1,2) as lp |
39 | 39 | |
40 | 40 | join |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | drupal.contribution_tracking LEFT JOIN civicrm.public_reporting |
55 | 55 | ON (contribution_tracking.contribution_id = civicrm.public_reporting.contribution_id) |
56 | 56 | where ts >= '%s' and ts < '%s' |
57 | | -and utm_campaign REGEXP 'JA' |
| 57 | +and utm_campaign REGEXP '[0-9](JA|SA|EA)[0-9]' |
58 | 58 | group by 1,2) as ecomm |
59 | 59 | |
60 | 60 | on ecomm.landing_page = lp.landing_page and ecomm.hr = lp.hr |
Index: trunk/fundraiser-statistics/reporting/landing_page_test.sql |
— | — | @@ -11,6 +11,7 @@ |
12 | 12 | donations / total_clicks as conversion_rate, |
13 | 13 | donations / views as don_per_view, |
14 | 14 | amount / views as amt_per_view, |
| 15 | +modified_amount / views as amt_per_view_reduced, |
15 | 16 | max_amt, |
16 | 17 | pp_don, |
17 | 18 | cc_don, |
— | — | @@ -39,6 +40,7 @@ |
40 | 41 | count(*) as total_clicks, |
41 | 42 | sum(not isnull(contribution_tracking.contribution_id)) as donations, |
42 | 43 | sum(converted_amount) AS amount, |
| 44 | +sum(if(converted_amount > 100, 100, converted_amount)) AS modified_amount, -- truncates donations over 100 |
43 | 45 | max(converted_amount) AS max_amt, |
44 | 46 | sum(if(right(utm_source,2)='cc',1,0)) as cc_clicks, |
45 | 47 | sum(if(right(utm_source,2)='cc' and contribution_tracking.contribution_id,1,0)) as cc_don, |