Last active
August 9, 2023 20:11
-
-
Save nicobrx/d18eec47931a52f5e5b096d5f2afbb43 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
--Looker Studio BigQuery custom query to get sessions per user | |
with s as (select distinct | |
user_pseudo_id, | |
concat(user_pseudo_id,(SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id')) AS session_id, | |
timestamp_micros(event_timestamp) as timestamp | |
from `yourbqproject.analytics_1234567.events_*` | |
where _table_suffix between @DS_START_DATE and @DS_END_DATE | |
and event_name = 'session_start') | |
select distinct | |
user_pseudo_id, | |
count(*) over (partition by user_pseudo_id) AS session_count | |
from s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment