You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Align default channel groupings with GA4 docs (Velir#282)
* Align default channel groupings with GA4 docs
* rename unit test class
* replace curly quotes with straight quotes
---------
Co-authored-by: Adam Ribaudo <[email protected]>
Copy file name to clipboardExpand all lines: models/staging/stg_ga4__sessions_traffic_sources.sql
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
with session_events as (
2
-
select
2
+
select
3
3
session_key
4
4
,event_timestamp
5
5
,events.event_source
@@ -17,11 +17,11 @@ with session_events as (
17
17
set_default_channel_grouping as (
18
18
select
19
19
*
20
-
,{{ga4.default_channel_grouping('event_source','event_medium','source_category')}} as default_channel_grouping
20
+
,{{ga4.default_channel_grouping('event_source','event_medium','source_category', 'event_campaign')}} as default_channel_grouping
21
21
from session_events
22
22
),
23
23
session_source as (
24
-
select
24
+
select
25
25
session_key
26
26
,COALESCE(FIRST_VALUE((CASE WHEN event_source <>'(direct)' THEN event_source END) IGNORE NULLS) OVER (session_window), '(direct)') AS session_source
27
27
,COALESCE(FIRST_VALUE((CASE WHEN event_source <>'(direct)' THEN COALESCE(event_medium, '(none)') END) IGNORE NULLS) OVER (session_window), '(none)') AS session_medium
Copy file name to clipboardExpand all lines: models/staging/stg_ga4__sessions_traffic_sources_daily.sql
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@
18
18
19
19
20
20
with session_events as (
21
-
select
21
+
select
22
22
client_key
23
23
,session_partition_key
24
24
,event_date_dt as session_partition_date
@@ -42,11 +42,11 @@ with session_events as (
42
42
set_default_channel_grouping as (
43
43
select
44
44
*
45
-
,{{ga4.default_channel_grouping('event_source','event_medium','source_category')}} as default_channel_grouping
45
+
,{{ga4.default_channel_grouping('event_source','event_medium','source_category', 'event_campaign')}} as default_channel_grouping
46
46
from session_events
47
47
),
48
48
first_session_source as (
49
-
select
49
+
select
50
50
client_key
51
51
,session_partition_key
52
52
,session_partition_date
@@ -63,13 +63,13 @@ first_session_source as (
63
63
),
64
64
find_non_direct_session_partition_key as (
65
65
66
-
select
66
+
select
67
67
*
68
68
,if(session_source <>'(direct)', session_partition_key, null) as non_direct_session_partition_key --provide the session_partition_key only if source is not direct. Useful for last non-direct attribution modeling
0 commit comments