From 739b47bf76e7a8902c785853529e54e58241b9ec Mon Sep 17 00:00:00 2001 From: tessa-beijloos Date: Mon, 16 Dec 2024 13:52:54 +0100 Subject: [PATCH] Update base_select.sql --- macros/base_select.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/macros/base_select.sql b/macros/base_select.sql index 6f7075db..bf76b3dc 100644 --- a/macros/base_select.sql +++ b/macros/base_select.sql @@ -140,7 +140,8 @@ )) from unnest(items) as unnested_items ) items , property_id - , {{ ga4.unnest_key('event_params', 'ga_session_id', 'int_value', 'session_id') }} + , COALESCE({{ ga4.unnest_key('event_params', 'ga_session_id', 'int_value', 'session_id') }}, + CAST(REGEXP_EXTRACT(COALESCE((select value.string_value from unnest(event_params) where key = 'ga_session_id') , ""), r'^GS\d\.\d\.(\d+)') AS INT64)) as session_id , {{ ga4.unnest_key('event_params', 'page_location') }} , {{ ga4.unnest_key('event_params', 'ga_session_number', 'int_value', 'session_number') }} , COALESCE(