You've successfully subscribed to GA4BigQuery
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

How to replicate the 'Behavior | Events | Top Events' report

Join 2,600+ other professionals and receive a monthly newsletter packed with GA4 & BigQuery news, tips & tricks

Great! Check your inbox and click the link to confirm your subscription
Please enter a valid email address!
Already have an account? Sign in
💡
This article is about GA3 - Universal Analytics

As a Google Analytics user you are probably quite attached to the default reports in the user interface of Universal Analytics. It can be hard to make sense of the data in the BigQuery export tables.

Let me enable you to replicate the reports you're familiar with. I'll try to keep it basic here.

Top Events report

In the Behavior | Events | Top Events report you'll find data about your events, segmented by event category, event action and event label.

Let's query!

select
  hits.eventinfo.eventcategory as event_category,
  -- hits.eventinfo.eventaction as event_action,
  -- hits.eventinfo.eventlabel as event_label,
  count(*) as total_events,
  count(distinct concat(cast(fullvisitorid as string), cast(visitstarttime as string))) as unique_events,
  ifnull(sum(hits.eventinfo.eventvalue),0) as event_value,
  ifnull(sum(hits.eventinfo.eventvalue) / count(*),0) as avg_value
from
  `bigquery-public-data.google_analytics_sample.ga_sessions_20160801`,
  unnest(hits) as hits
where
  totals.visits = 1
  and hits.type = 'EVENT'
  and hits.eventinfo.eventcategory is not null
group by
  event_category
  -- ,event_action
  --, event_label
order by total_events desc