Skip to content

Instantly share code, notes, and snippets.

@atopal
Created October 23, 2012 14:04
Show Gist options
  • Save atopal/3938920 to your computer and use it in GitHub Desktop.
Save atopal/3938920 to your computer and use it in GitHub Desktop.
Counting visitors on AAQ
-- Count first step of AAQ. Asking them to register or sign-in (only if not logged in yet)
select ds, count(1) as visitors
FROM research_logs
WHERE
ds >= '2012-10-10'
AND `domain`='support.mozilla.com'
AND ip_address != 'NULL' AND http_version = 200 AND request_type = 'POST'
AND parse_url(concat('http://a.com',request_url),'PATH') RLIKE '\\/questions\\/'
AND parse_url(concat('http://a.com',request_url),'QUERY','step') = 'aaq-register'
AND user_agent NOT LIKE '%bot%'
GROUP BY ds;
-- Count second step of AAQ. Asking for question (everyone gets this)
select ds, count(1) as visitors
FROM research_logs
WHERE
ds >= '2012-10-10'
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 '\\/questions\\/'
AND parse_url(concat('http://a.com',request_url),'QUERY','step') = 'aaq-question'
AND user_agent NOT LIKE '%bot%'
GROUP BY ds;
-- Count last page of AAQ (only those who haven't approved email address yet)
select ds, count(1) as visitors
FROM research_logs
WHERE
ds >= '2012-10-10'
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 '\\/questions/new/confirm'
AND user_agent NOT LIKE '%bot%'
GROUP BY ds;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment