Skip to content

Instantly share code, notes, and snippets.

@zhangw
Forked from lacerogers20/simple_extract.sql
Created August 26, 2022 09:39
Show Gist options
  • Save zhangw/4b107f1a6f5136c5fa7d618071aea6d6 to your computer and use it in GitHub Desktop.
Save zhangw/4b107f1a6f5136c5fa7d618071aea6d6 to your computer and use it in GitHub Desktop.
SELECT
date,
COUNT(DISTINCT(visitid)) as unique_visits
FROM `bigquery-public-data.google_analytics_sample.ga_sessions_*`
WHERE _table_suffix = '20170801' # use date_sub to programmatically select your table
GROUP BY date
ORDER BY date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment