Skip to content

Instantly share code, notes, and snippets.

@scips
Created June 2, 2022 12:33
Show Gist options
  • Save scips/0cba22c19ecef8b8a38f4a7737e94e25 to your computer and use it in GitHub Desktop.
Save scips/0cba22c19ecef8b8a38f4a7737e94e25 to your computer and use it in GitHub Desktop.
SELECT event_date, device.web_info.browser, REGEXP_EXTRACT(device.web_info.browser_version, r'^(\d+)') as browser_major_version, COUNT(*) as total
FROM `*-analytics-*.analytics_*.events_*`
WHERE platform='WEB' AND event_name = 'page_view' AND event_date BETWEEN FORMAT_DATE("%Y%m%d",DATE_ADD(CURRENT_DATE(), INTERVAL -1 WEEK)) AND FORMAT_DATE("%Y%m%d",CURRENT_DATE())
GROUP BY event_date, device.web_info.browser, browser_major_version
ORDER BY event_date DESC,total DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment