Skip to content

Instantly share code, notes, and snippets.

@funami
Created November 24, 2022 04:42
Show Gist options
  • Save funami/8556e77adcf00a5a1c595ea68f55b2e2 to your computer and use it in GitHub Desktop.
Save funami/8556e77adcf00a5a1c595ea68f55b2e2 to your computer and use it in GitHub Desktop.
SELECT
event_date,
event_timestamp,
user_first_touch_timestamp,
event_name,
user_id,
user_pseudo_id,
traffic_source.name traffic_source_name,
traffic_source.medium traffic_source_medium,
traffic_source.source traffic_source_source,
device.category device_category
, (SELECT value.string_value FROM UNNEST(event_params) AS params WHERE params.key = 'page_location') AS page_location
, (SELECT value.string_value FROM UNNEST(event_params) AS params WHERE params.key = 'page_title') AS page_title
, (SELECT value.int_value FROM UNNEST(event_params) AS params WHERE params.key = 'entrances') AS entrances
FROM `ec-analysis-338708.analytics_277912308.events_*`
WHERE
traffic_source.medium = "email"
AND event_name = "page_view"
AND (_TABLE_SUFFIX BETWEEN "20221117" AND "20221124")
ORDER BY user_pseudo_id, event_timestamp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment