Request a demo

GA4 in BigQuery · Engagement and events

Engagement rate and engaged sessions in GA4 BigQuery

Engagement rate in GA4 is engaged sessions divided by sessions. In the export a session is engaged when any of its events has session_engaged = '1'. Group events by user_pseudo_id and ga_session_id, flag engaged sessions with LOGICAL_OR, then divide.

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

The query

WITH events AS (
  SELECT
    event_date,
    user_pseudo_id,
    (SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id') AS ga_session_id,
    (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 '20201207'
),
sessions AS (
  SELECT
    user_pseudo_id,
    ga_session_id,
    MIN(event_date)                   AS session_date,
    LOGICAL_OR(session_engaged = '1') AS is_engaged
  FROM events
  GROUP BY user_pseudo_id, ga_session_id
)
SELECT
  PARSE_DATE('%Y%m%d', session_date)                AS day,
  COUNT(*)                                          AS sessions,
  COUNTIF(is_engaged)                               AS engaged_sessions,
  ROUND(SAFE_DIVIDE(COUNTIF(is_engaged), COUNT(*)), 4) AS engagement_rate
FROM sessions
GROUP BY day
ORDER BY day;

How it works

Google defines an engaged session as one that lasts longer than 10 seconds, has a key event, or has 2 or more page or screen views. Engagement rate is the percentage of sessions that were engaged, and bounce rate is the rest (see bounce rate).

You do not have to rebuild that rule from timestamps. The export carries a session_engaged parameter on events, set to 1 once the session counts as engaged, so a session is engaged if any of its events carries session_engaged = '1'. The query reads it per event, groups by session, and uses LOGICAL_OR to flag the session.

Watch the type. In this sample session_engaged is a string on 3,682,921 events and an integer on 313,391, and values include both '1' and '0'. Reading only string_value would miss engaged sessions whose flag arrived as an integer, so the query normalizes both slots to a string first. Check your own export with the inventory in export schema.

Each session is assigned to the day of its first event, so a session crossing midnight counts once. The sample also has an integer engaged_session_event parameter; it is a different flag and not needed for this metric.

ColumnMeaning
sessionsSessions whose first event falls on the day.
engaged_sessionsSessions with at least one event where session_engaged is 1.
engagement_rateEngaged sessions divided by sessions, as a fraction (0.65 means 65%).

Notes and cost

  • Cost: both parameters live in event_params, and session_engaged is mostly a string, so the query reads key, int_value and string_value: 155.5 MiB for one week. Engagement rate per day is a classic candidate for a daily summary table: compute it once, read a few kilobytes afterwards.
  • Sessions that started before the range and continue into it are counted on the first day of the range with only part of their events. Read an extra day before the range if the first day must be exact.
  • GA4 reports estimate sessions with HyperLogLog++, so the denominator differs slightly from BigQuery's exact count.

Variations

Engagement rate by device category

WITH sessions AS (
  SELECT
    user_pseudo_id,
    (SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id') AS ga_session_id,
    ANY_VALUE(device.category) AS device_category,
    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 '20201207'
  GROUP BY user_pseudo_id, ga_session_id
)
SELECT
  device_category,
  COUNT(*)                                          AS sessions,
  ROUND(SAFE_DIVIDE(COUNTIF(is_engaged), COUNT(*)), 4) AS engagement_rate
FROM sessions
GROUP BY device_category
ORDER BY sessions DESC;

FAQ

How is engagement rate calculated in GA4 BigQuery?

Engaged sessions divided by sessions. A session is engaged if any of its events has the session_engaged parameter set to 1; group by user_pseudo_id and ga_session_id and use LOGICAL_OR to flag it.

What makes a GA4 session engaged?

Google's definition: the session lasts longer than 10 seconds, has a key event, or has 2 or more page or screen views.

Why does session_engaged = '1' miss some sessions?

Because the parameter is sometimes stored in int_value instead of string_value. Use COALESCE(value.string_value, CAST(value.int_value AS STRING)).

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.