Created
October 17, 2012 16:57
-
-
Save atopal/3906711 to your computer and use it in GitHub Desktop.
a/b testing of new forum excerpts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT table_numerator.ds, table_numerator.numerator AS clicks, table_denominator.denominator AS searches, round((table_numerator.numerator/ table_denominator.denominator), 2) AS CTR | |
FROM | |
( | |
select ds, count(*) AS numerator | |
FROM research_logs | |
WHERE | |
ds > '2012-10-09' | |
AND `domain`='support.mozilla.com' | |
AND ip_address != 'NULL' AND http_version = 200 AND request_type = 'GET' | |
AND parse_url(empty_string_1,'PATH') RLIKE '\\/en-US\/search\$' | |
AND parse_url(empty_string_1,'HOST') = 'support.mozilla.org' | |
AND | |
( parse_url(concat('http://a.com',request_url),'PATH') RLIKE '\\/kb\\/' | |
OR parse_url(concat('http://a.com',request_url),'PATH') RLIKE '\\/questions\\/\\d+\$' | |
) | |
AND parse_url(concat('http://a.com',request_url),'QUERY','as') = 's' | |
AND parse_url(concat('http://a.com',request_url),'QUERY','esab') = 'b' | |
AND user_agent NOT LIKE '%bot%' | |
AND user_agent NOT LIKE '%Netsparker%' | |
group by ds | |
) table_numerator | |
JOIN ( | |
select ds, count(*) as denominator | |
FROM research_logs | |
WHERE | |
ds > '2012-10-09' | |
AND `domain`='support.mozilla.com' | |
AND ip_address != 'NULL' AND http_version = 200 AND request_type = 'GET' | |
AND parse_url(concat('http://a.com',request_url),'PATH') RLIKE '\\/en-US\/search\$' | |
AND parse_url(concat('http://a.com',request_url),'QUERY','a') IS NULL | |
AND parse_url(concat('http://a.com',request_url),'QUERY','page') IS NULL | |
AND parse_url(concat('http://a.com',request_url),'QUERY','format') IS NULL | |
AND user_agent NOT LIKE '%bot%' | |
AND user_agent NOT LIKE '%Netsparker%' | |
group by ds | |
) table_denominator ON table_numerator.ds=table_denominator.ds; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
esab is the parameter for a/b testing. the options are 'a' and 'b'