-
Discrepancy between GA4 traffic source data and BigQuery records
Hey there, I need some help. I’ve been trying to match up traffic source data and event attribution data from BigQuery with GA4, using the session_source and session_medium. The thing is, when I pull the event parameters like source and medium from BigQuery, I’m noticing a rather sizeable difference between the two sets of data. Any ideas on how to crack this nut?
I’ve been fiddling with the SQL below, but no dice so far:
with prep as ( select user_pseudo_id, (select value.int_value from unnest(event_params) where key = 'ga_session_id') as session_id, max((select value.string_value from unnest(event_params) where key = 'source')) as source, max((select value.string_value from unnest(event_params) where key = 'medium')) as medium, max((select value.string_value from unnest(event_params) where key = 'name')) as campaign, max((select value.string_value from unnest(event_params) where key = 'term')) as term, max((select value.string_value from unnest(event_params) where key = 'content')) as content, platform, FROM
XXX
group by user_pseudo_id, session_id, platform ) select -- session medium (dimension | the value of a medium associated with a session) platform, coalesce(source,'()') as source_session, coalesce(medium,'()') as medium_session, coalesce(campaign,'()') as campaign_session, coalesce(content,'()') as content, coalesce(term,'()') as term, count(distinct concat(user_pseudo_id,session_id)) as sessions from prep group by platform, source_session, medium_session, campaign_session, content, term order by sessions desc
Log in to reply.