Created
April 9, 2024 16:50
-
-
Save nicobrx/364149793ea486c2b9c71bdb1fba65bd to your computer and use it in GitHub Desktop.
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 | |
-- day of week, starting with Sunday (dimension) | |
format_date('%w',parse_date("%Y%m%d",event_date)) as day_of_week, | |
-- hour (dimension) | |
format("%02d",extract(hour from timestamp_micros(event_timestamp))) as hour, | |
(select value.string_value from unnest(event_params) where key = 'page_location') as page_path, | |
count(event_name) as sessions | |
from | |
-- change this to your google analytics 4 export location in bigquery | |
`yourproject.analytics_1234567.events_*` | |
where | |
-- uses dynamic start and end date parameters supported by Looker Studio | |
_table_suffix between @DS_START_DATE and @DS_END_DATE | |
and event_name = "session_start" | |
group by | |
day_of_week, hour, page_path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment