Request a demo

GA4 in BigQuery · Ecommerce and conversions

Key events (conversions) and conversion rate in GA4 BigQuery

The GA4 export has no flag for key events (formerly conversions): you list your key event names in SQL. Count them, count sessions and users that triggered them, and divide by all sessions or users to get session and user key event rates.

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

The query

WITH events AS (
  SELECT
    event_name,
    user_pseudo_id,
    CONCAT(user_pseudo_id, '.', CAST((SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id') AS STRING)) AS session_key
  FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
  WHERE _TABLE_SUFFIX BETWEEN '20201201' AND '20201231'
),
totals AS (
  SELECT
    COUNT(DISTINCT session_key)    AS sessions,
    COUNT(DISTINCT user_pseudo_id) AS users
  FROM events
)
SELECT
  e.event_name                                                     AS key_event,
  COUNT(*)                                                         AS key_events,
  COUNT(DISTINCT e.session_key)                                    AS sessions_with_key_event,
  ROUND(COUNT(DISTINCT e.session_key) / ANY_VALUE(t.sessions), 4)  AS session_key_event_rate,
  ROUND(COUNT(DISTINCT e.user_pseudo_id) / ANY_VALUE(t.users), 4)  AS user_key_event_rate
FROM events AS e
CROSS JOIN totals AS t
WHERE e.event_name IN ('purchase', 'begin_checkout', 'add_to_cart')
GROUP BY key_event
ORDER BY key_events DESC;

How it works

In GA4 you mark events as key events (the name for conversions since 2024) in the property settings. That setting is not exported: no column in the export says whether an event is a key event. Your SQL has to name them, so keep the list in one place, such as a small table or a temporary function, and keep it in sync with the property.

The query counts each key event, the sessions and users that triggered it, and two rates. Session key event rate is the share of sessions with the key event; user key event rate is the share of users. Both divide by all sessions or users in the range, including those with no key event. GA4 reports offer the same two metrics, per key event or across all of them.

The list here (purchase, begin_checkout, add_to_cart) is an example for the Merchandise Store sample. Use the key events of your own property.

ColumnMeaning
key_eventEvent name from your key event list.
key_eventsHow many times it fired.
sessions_with_key_eventDistinct sessions with at least one.
session_key_event_rate / user_key_event_rateShare of all sessions and of all users in the range that triggered it.

Notes and cost

  • Cost: the session key reads event_params.key and int_value, 363.4 MiB for one month. Counting key events and users only, without sessions, skips event_params entirely and costs 51.9 MiB (first variation).
  • GA4 can count a key event once per event or once per session, depending on the counting method you set for it. The export always holds every event, so COUNT(*) matches once-per-event counting and COUNT(DISTINCT session_key) matches once-per-session counting.

Variations

Key events and converting users, no session key

SELECT
  event_name                     AS key_event,
  COUNT(*)                       AS key_events,
  COUNT(DISTINCT user_pseudo_id) AS users
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20201201' AND '20201231'
  AND event_name IN ('purchase', 'begin_checkout', 'add_to_cart')
GROUP BY key_event
ORDER BY key_events DESC;

Key event rate per day, any key event

WITH sessions AS (
  SELECT
    MIN(event_date)                                                       AS session_date,
    LOGICAL_OR(event_name IN ('purchase', 'begin_checkout', 'add_to_cart')) AS has_key_event
  FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
  WHERE _TABLE_SUFFIX BETWEEN '20201201' AND '20201231'
  GROUP BY user_pseudo_id, (SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id')
)
SELECT
  PARSE_DATE('%Y%m%d', session_date)                     AS day,
  COUNT(*)                                              AS sessions,
  ROUND(COUNTIF(has_key_event) / COUNT(*), 4)           AS session_key_event_rate
FROM sessions
GROUP BY day
ORDER BY day;

FAQ

Are GA4 conversions marked in the BigQuery export?

No. Key events (formerly conversions) are a property setting, and the export has no column for it. List the key event names in your SQL.

How do I calculate conversion rate from GA4 BigQuery?

Sessions with a key event divided by all sessions gives session key event rate; users with a key event divided by all users gives user key event rate.

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.