-
Google Analytics 4 and BigQuery: How to Get Accurate Event Counts by Event Name
I’m on a mission to extract total event count data from GA4 using BigQuery for different web platforms on a subdomain level. All was good until I started to include device.web_info.hostname in the pull – that’s when the count turned weird.
Here’s what I tried out:
`sh
select
event_date
, device.web_info.hostname
, platform
, count(distinct case when event_name = ‘job_search__search’ then concat(user_pseudo_id,(select value.int_value from unnest(event_params) where key = ‘ga_session_id’), event_timestamp) end) as event_count_via_concat
, countif(event_name = ‘job_search__search’) as event_count_via_countif
, count(*) as event_count_naive
fromxxx.xxx.events_itable
where
lower(platform) = ‘web’
and device.web_info.hostname in (‘au.xx.com’, ‘nz.xx.com’, ‘my.xx.com’)
and event_name in (‘job_search__search’)
group by 1,2,3
`
I’m seeing some strange differences where my data doesn’t match up with GA4’s total events report. Any idea what’s up?
I’ve included screenshots from BigQuery and GA4 (links given), in case those help. Appreciate the help, good folks!
Log in to reply.