Request a demo

GA4 in BigQuery · Engagement and events

Count GA4 events by name in BigQuery

Count GA4 events with COUNT(*) grouped by event_name. It reads one small column, so it is the cheapest query on the export and the first one to compare with the Event count in GA4. The whole public sample costs about 53 MiB.

Runs on Google's public sample bigquery-public-data.ga4_obfuscated_sample_ecommerce · Scans 53.4 MiB, under $0.01 on-demand · Checked in November 2026

The query

SELECT
  event_name,
  COUNT(*) AS events
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
GROUP BY event_name
ORDER BY events DESC;

Result on the sample

First rows
event_nameevents
page_view1350428
user_engagement1058721
scroll493072
view_item386068
session_start354970
first_visit257462
view_promotion190104
add_to_cart58543
begin_checkout38757
select_item31007

How it works

Each row of the export is one event, so COUNT(*) per event_name is GA4's Event count by Event name. This query reads only the event_name column, which makes it the cheapest useful query on the export: the whole three-month sample costs 53.4 MiB, against 3.34 GiB for SELECT *.

The result is the shape of the Google Merchandise Store implementation: automatically collected events (first_visit, session_start, user_engagement), enhanced measurement (page_view, scroll, click, view_search_results) and the ecommerce funnel (view_item, add_to_cart, begin_checkout, add_shipping_info, add_payment_info, purchase). The sample has 17 event names in total; the last rows are purchase (5,692), click (1,446) and view_item_list (71).

This is also the first check when BigQuery and the interface disagree. Google's guide says to compare the total events for a date in BigQuery with the Event count for the same date in Analytics, and expects a difference of 2 to 5 percent. If the totals match, a mismatch in users or sessions comes from how they are counted, not from missing data.

ColumnMeaning
event_nameName of the event, as collected.
eventsNumber of events with that name in the scanned tables.

Notes and cost

  • No _TABLE_SUFFIX filter here on purpose, to show the whole sample. On a real export, always add one: the cost of this query grows with every day the export adds.
  • Events you excluded in the GA4 BigQuery link settings never reach the export, so they will be missing here but present in GA4 reports.
  • Event names are case sensitive. Purchase and purchase are two events; check for near-duplicates when an implementation changed.

Variations

Events per day and name

SELECT
  PARSE_DATE('%Y%m%d', event_date) AS day,
  event_name,
  COUNT(*)                         AS events
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20201201' AND '20201207'
GROUP BY day, event_name
ORDER BY day, events DESC;

Events per session

Average and median events per session. Needs the session key, so it reads event_params.

WITH sessions AS (
  SELECT
    user_pseudo_id,
    (SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id') AS ga_session_id,
    COUNT(*) AS events
  FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
  WHERE _TABLE_SUFFIX BETWEEN '20201201' AND '20201207'
  GROUP BY user_pseudo_id, ga_session_id
)
SELECT
  COUNT(*)                                 AS sessions,
  ROUND(AVG(events), 1)                    AS avg_events_per_session,
  APPROX_QUANTILES(events, 2)[OFFSET(1)]   AS median_events_per_session
FROM sessions;

FAQ

How do I count events in GA4 BigQuery?

SELECT event_name, COUNT(*) FROM events_* GROUP BY event_name, with a _TABLE_SUFFIX filter for the date range. Each row in the export is one event.

Why does my event count differ from GA4?

Google expects 2 to 5 percent difference in total event count. Larger gaps usually come from events or streams excluded from the export, a time zone mismatch, or comparing days that are still receiving late events.

All GA4 export queries · BigQuery cost queries · The GA4 sample dataset

Cut BigQuery spend without guessing

Masthead attributes compute and storage cost to every project, user, pipeline and table, finds unused and dead-end tables, and shows where editions or on-demand pricing is cheaper. Mnemonic cut its BigQuery compute cost by 20% within 24 hours of onboarding.