Request a demo

GA4 in BigQuery · Engagement and events

Bounce rate by landing page in GA4 BigQuery

In GA4, bounce rate is the share of sessions that were not engaged: 1 minus engagement rate. In BigQuery, flag each session engaged if any event has session_engaged = '1', take the landing page from its first page_view, and divide non-engaged sessions by sessions.

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

The query

WITH events AS (
  SELECT
    user_pseudo_id,
    event_timestamp,
    event_name,
    (SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id') AS ga_session_id,
    (SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'page_location') AS page_location,
    (SELECT COALESCE(value.string_value, CAST(value.int_value AS STRING))
       FROM UNNEST(event_params) WHERE key = 'session_engaged') AS session_engaged
  FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
  WHERE _TABLE_SUFFIX BETWEEN '20201201' AND '20201231'
),
sessions AS (
  SELECT
    ARRAY_AGG(IF(event_name = 'page_view', page_location, NULL) IGNORE NULLS
              ORDER BY event_timestamp LIMIT 1)[SAFE_OFFSET(0)] AS landing_page,
    LOGICAL_OR(session_engaged = '1')                            AS is_engaged
  FROM events
  GROUP BY user_pseudo_id, ga_session_id
)
SELECT
  REGEXP_REPLACE(landing_page, r'[?#].*$', '')                   AS landing_page,
  COUNT(*)                                                      AS sessions,
  COUNTIF(NOT is_engaged OR is_engaged IS NULL)                  AS bounced_sessions,
  ROUND(SAFE_DIVIDE(COUNTIF(NOT is_engaged OR is_engaged IS NULL), COUNT(*)), 4) AS bounce_rate
FROM sessions
GROUP BY landing_page
HAVING sessions >= 100
ORDER BY sessions DESC
LIMIT 20;

How it works

Google defines bounce rate in GA4 as the percentage of sessions that were not engaged, the inverse of engagement rate. An engaged session lasts longer than 10 seconds, has a key event, or has 2 or more page or screen views. A visitor who reads one page for a minute and leaves is not a bounce in GA4, while it was in Universal Analytics, where a bounce was a single-hit session.

The query reuses the session logic from engagement rate and adds the landing page from landing pages: one pass over the events, one row per session with its first page and an engaged flag, then bounce rate per landing page. Sessions where no event carries session_engaged get a NULL flag and are counted as bounced.

HAVING sessions >= 100 keeps pages with enough sessions for the rate to mean something. Lower it on small sites.

ColumnMeaning
landing_pageFirst page of the session, without query string. NULL for sessions with no page view in range.
sessionsSessions starting on the page.
bounced_sessionsSessions with no event marked session_engaged = 1.
bounce_rateBounced sessions divided by sessions.

Notes and cost

  • Cost: needs ga_session_id, page_location and session_engaged, so it reads every part of event_params that matters: 585.6 MiB for one month. If several dashboards show bounce rate, materialize sessions once and compute it from there.
  • To match a GA4 report, use the same date range, the property's time zone, and complete days at least three days old. Expect small differences from HyperLogLog++ session estimates.

Variations

Site-wide bounce rate per day

WITH sessions AS (
  SELECT
    MIN(event_date)               AS session_date,
    LOGICAL_OR((SELECT COALESCE(value.string_value, CAST(value.int_value AS STRING))
       FROM UNNEST(event_params) WHERE key = 'session_engaged') = '1') AS is_engaged
  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(1 - SAFE_DIVIDE(COUNTIF(is_engaged), COUNT(*)), 4)               AS bounce_rate
FROM sessions
GROUP BY day
ORDER BY day;

FAQ

How does GA4 define bounce rate?

As the percentage of sessions that were not engaged sessions. It is 1 minus engagement rate.

Why is GA4 bounce rate lower than Universal Analytics bounce rate?

Universal Analytics counted any single-hit session as a bounce. GA4 counts a one-page session as engaged if it lasted longer than 10 seconds or had a key event.

How do I calculate bounce rate in BigQuery for GA4?

Group events into sessions, flag a session engaged if any event has session_engaged = 1, and divide non-engaged sessions by all sessions.

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.