Request a demo

GA4 in BigQuery · Working with the export

Why GA4 BigQuery numbers differ from the GA4 interface

BigQuery holds raw events, while GA4 reports estimate users and sessions with HyperLogLog++, may apply thresholds, sampling and consent-mode modeling, use the reporting identity and time zone, and show active users. Google expects a 2 to 5 percent gap in total event counts.

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

The query

-- Exact counts next to the HyperLogLog++ estimates GA4 reports use
WITH events AS (
  SELECT
    event_date,
    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 '20201207'
)
SELECT
  event_date,
  COUNT(*)                                           AS events,
  COUNT(DISTINCT user_pseudo_id)                     AS total_users_exact,
  HLL_COUNT.EXTRACT(HLL_COUNT.INIT(user_pseudo_id, 14)) AS total_users_hll,
  COUNT(DISTINCT session_key)                        AS sessions_exact,
  HLL_COUNT.EXTRACT(HLL_COUNT.INIT(session_key, 12)) AS sessions_hll
FROM events
GROUP BY event_date
ORDER BY event_date;

How it works

The export is the raw event stream. The reports in the GA4 interface are computed from the same events, with extra processing that the export does not contain. Google's own guidance names these differences:

Approximate counts. GA4 reports, Explorations and Looker Studio estimate distinct counts such as Active users and Sessions with HyperLogLog++. Google's developer guide gives precision 14 for users and 12 for sessions, and quotes a precision of about ±1.63% for session counts at a 95% confidence interval. BigQuery's COUNT(DISTINCT) is exact. The query puts both side by side, using BigQuery's HLL_COUNT.INIT and HLL_COUNT.EXTRACT at Google's precisions (for a quick estimate without a precision setting, see APPROX_COUNT_DISTINCT). Google also notes a small extra difference for user counts up to about 12,200, because BigQuery fixes the sparse precision at precision + 5 while GA4 uses a higher one.

Active users, not total users. The Users number in most GA4 reports is Active users. Distinct user_pseudo_id is Total users. Newer exports have is_active_user to filter on; this sample does not (see users).

Identity. Google exports only device-ID based data. Reports that use Google signals or a blended reporting identity deduplicate users across devices, so they usually show fewer users. To compare, Google suggests temporarily switching the reporting identity to device-based.

Thresholding and sampling. GA4 may withhold rows in reports with demographics, search queries or small counts. Thresholds are system defined and cannot be adjusted, and data from Google signals is not exported to BigQuery. Explorations can be sampled. BigQuery is neither.

Consent mode. Behavioral and key event modeling fill gaps from users who declined consent in reports; modeled data is not in BigQuery. Cookieless pings do reach the export, each session with a different user_pseudo_id.

Time zone and late data. event_date follows the property's reporting time zone, event_timestamp is UTC, and daily tables keep receiving late events for up to 72 hours. Compare complete days older than three days.

Attribution and export settings. GA4's session attribution model is not in the export and cannot be rebuilt exactly. Events or data streams excluded from the export, and the daily export limit, also cause gaps.

ColumnMeaning
eventsRows in the export for the day. Compare this with the Event count in GA4 first: Google expects a 2 to 5 percent difference.
total_users_exact / total_users_hllDistinct user_pseudo_id, exact and estimated at precision 14.
sessions_exact / sessions_hllDistinct user_pseudo_id + ga_session_id, exact and estimated at precision 12.

Notes and cost

  • Google's public sample cannot be compared with the GA4 demo account at all: Google says the data differs. Run the comparison on your own property.
  • Cost: the session key needs event_params, so this week costs 98.8 MiB. The event and user columns alone cost 13.0 MiB (first variation). Check event totals first; only reach for sessions when the event totals match.
  • Do not add up daily distinct users or sessions to get a weekly number. Users who return on several days, and sessions that cross midnight, are counted again on each day. Compute the distinct count over the whole range instead.
  • GA4 groups rare values into an (other) row when a report exceeds its cardinality limit. The totals still match, but a per-page or per-campaign breakdown in the interface may not.

Variations

Event totals per day, the first thing to compare

Google's troubleshooting starts with the total event count for a date. This reads no nested columns.

SELECT
  event_date,
  COUNT(*)                       AS events,
  COUNT(DISTINCT user_pseudo_id) AS total_users
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20201201' AND '20201207'
GROUP BY event_date
ORDER BY event_date;

Event time in the reporting time zone

Replace the zone with your property's reporting time zone, then group by the local date to line up with the interface.

SELECT
  DATE(TIMESTAMP_MICROS(event_timestamp), 'America/Los_Angeles') AS local_date,
  event_date,
  COUNT(*)                                                     AS events
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20201201' AND '20201207'
GROUP BY local_date, event_date
ORDER BY local_date, event_date;

FAQ

How big a difference between GA4 and BigQuery is normal?

Google's comparison guide says a discrepancy of 2 to 5 percent in total event count between Analytics and BigQuery is expected. Larger gaps usually point to export filters, the wrong project, a time zone mismatch or query logic.

Does GA4 use HyperLogLog?

Yes. Since 2021, GA4 estimates distinct counts such as Active users and Sessions with HyperLogLog++. BigQuery's COUNT(DISTINCT) is exact, so small differences are expected.

Is Google signals data in the BigQuery export?

No. Google states that Analytics doesn't export data from Google signals to BigQuery, which is one reason user counts in the export are higher.

Why do the numbers for yesterday keep changing?

Daily tables can be updated with late events for up to 72 hours after the date. Compare days that are at least three days old.

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.