Sub topic 12
Getting around the limits with the BigQuery export
This chapter assumes you know how to read a GA4 report, the difference between dimensions and metrics, what events, users, and sessions are, and basic SQL. Earlier chapters covered data thresholds, sampling, and the (other) row. Here you will see how the BigQuery export avoids most of them, and what it costs you in return.
What the export is
The BigQuery export is a link between a GA4 property and a BigQuery project. Once linked, GA4 writes event-level data into a dataset named analytics_<property ID>. Each row in an events table is one event, with its parameters, user properties, device, geography, and traffic source fields.
Reports and Explorations show you aggregated tables that GA4 has already processed. The export gives you the events before that aggregation, so you do the aggregation yourself with SQL.
Which limits the export avoids
| Limit | In reports and Explorations | In the BigQuery export |
|---|---|---|
| Data thresholds | Rows are withheld when counts are small and Google signals or demographics are involved | Not applied. Every event row is present |
| Sampling | Explorations estimate from a subset when a query exceeds quota | Not applied. You query all exported events |
| The (other) row | Rows are merged when a dimension has too many unique values | Not applied. Each value is a separate row in your query result |
| Row limits per report | Tables are capped | You control the result size |
The export has no thresholding because it does not contain the demographic or Google signals data that triggers thresholds. Demographic fields such as age and gender are not in the export. The export also identifies people with user_pseudo_id (a pseudonymous device-level ID) and, if you set one, user_id. It does not apply reporting identity blending.
Diagram: where each surface sits
Setting up the link
You need Editor access on the GA4 property and permission to create resources in the Google Cloud project. The steps are:
- In GA4, open Admin, then Product links, then BigQuery links.
- Choose Link and select your Google Cloud project.
- Pick a data location. You cannot change it later without recreating the link.
- Choose a frequency: daily, streaming, or both.
- Submit the link.
The three table types are worth knowing:
events_YYYYMMDDholds the complete export for a finished day. It is written daily.events_intraday_YYYYMMDDholds the current day's events. It is updated continuously when streaming is on, and is deleted when the daily table is complete.events_*is a wildcard that matches the daily tables. It does not matchevents_intraday_*tables, so a query onevents_*does not include today's events.
Data starts flowing from the day you create the link. The export does not backfill history. If you need data from before the link, you will not find it there, and that is the main reason to link early.
A first query
The query below counts daily users per page. Because it reads event rows directly, it has no thresholding and no (other) row, even for a page with only a handful of visitors.
SELECT
event_date,
(SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'page_location') AS page_location,
COUNT(DISTINCT user_pseudo_id) AS users
FROM `my-project.analytics_123456789.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20260101' AND '20260131'
AND event_name = 'page_view'
GROUP BY event_date, page_location
ORDER BY users DESC;Three details in this query matter:
event_paramsis a repeated record, an array of key and value pairs. To read one parameter you use a subquery overUNNEST(event_params)and filter on the key.- Parameter values sit in typed fields:
string_value,int_value,float_value, ordouble_value. Reading the wrong one returnsNULL. - The
_TABLE_SUFFIXfilter limits which daily tables BigQuery scans. Without it, the query reads every table and costs more.
Replace the project, dataset, and dates with your own.
Why page_location is not the same as pagePath
The query groups by the full URL in page_location, which includes the query string. The report dimension pagePath does not. Two URLs that differ only in a tracking parameter appear as two rows in BigQuery and as one row in a report. High-cardinality values are not merged away in BigQuery, so you often have to clean them yourself. A common approach is to strip the query string with REGEXP_EXTRACT(page_location, r'^[^?#]+') before you group.
Differences you must expect
The export avoids the limits, but its numbers will not always match the interface. These are the usual causes.
Counting rules differ
The Active users metric in reports counts users with an engaged session or a first_visit or engagement-type activity. In BigQuery, COUNT(DISTINCT user_pseudo_id) counts every device ID that sent any matching event. If you filter on page_view, you count users who viewed a page, which can be higher than active users.
To approximate the report definition, count users with engagement, for example by checking session_engaged through the ga_session_id and engagement signals in your own logic. Expect small gaps even then.
Sessions are not a column
There is no session table. You build sessions from the ga_session_id event parameter combined with user_pseudo_id:
SELECT
COUNT(DISTINCT CONCAT(
user_pseudo_id, '-',
CAST((SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id') AS STRING)
)) AS sessions
FROM `my-project.analytics_123456789.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20260101' AND '20260131';The ga_session_id value is a timestamp, and it is only unique within one user. Combining it with user_pseudo_id makes a unique session key. Using ga_session_id alone would merge sessions from different users who started in the same second.
Attribution fields are limited
Fields such as traffic_source describe the user's first acquisition, not the current session. Session-level source and medium are available as event parameters on some events, and in newer exports in a collected_traffic_source field. Check your own table schema, because the available fields have changed over time and a query that works on one property may return NULL on another.
Modeled and blended data are absent
Reports can include behavioral modeling for users who declined consent, and they can use blended reporting identity. The export contains only the data collected. If you use Consent Mode, the numbers in BigQuery may be lower than in reports for that reason.
Time zones
event_date is in the property's reporting time zone. event_timestamp is in microseconds since the Unix epoch, in UTC. Mixing them in a query can put an event on a different day than the report does.
Export limits
Standard properties can export up to one million events per day to the daily table. Properties above that limit are not guaranteed a complete daily export, and Google documents that the daily export can be paused if the limit is exceeded. Streaming export has no such cap, but it does cost extra. Check the current documentation for your property tier, since these limits change.
Costs and access
BigQuery charges for storage and for the data each query scans. The export itself is free for the daily option up to the limits above, and the streaming option adds a charge. Three habits keep query costs down:
- Filter on
_TABLE_SUFFIXin every query. - Select only the columns you need. BigQuery bills by the columns read, so
SELECT *costs the most. - Create a smaller summary table once, and have dashboards read that table.
Because the export holds user-level pseudonymous data, treat access carefully. Grant dataset access only to people who need it, and follow your privacy policy and consent obligations. The export can contain identifiers, so it is subject to the same rules as any other data you collect about people.
Choosing between BigQuery and the other surfaces
Use the export when you need exact counts for small segments, full lists of high-cardinality values, joins with other data such as CRM or ad cost tables, or long retention beyond the interface's event-data retention setting. Use reports or the Data API when you need GA4's own definitions of users, sessions, attribution, and conversions, or when you need an answer quickly without writing SQL.
A useful check combines both. Run the same report in the interface and in the Data API, read the metadata flags data_loss_from_other_row and subject_to_thresholding, and if either is set, rebuild the question in BigQuery. A gap between the two is expected for the reasons above. A large gap with no flags set points to a query mistake, such as a missing event_name filter or the wrong date range.
Summary
The BigQuery export gives you event rows with no thresholding, no sampling, and no (other) row. You pay for this with SQL work, rebuilt definitions, and storage and query costs. It also holds no history from before the link was made.
Exercise
A page in the Pages and screens report shows only a few rows, and the Data API response for the same request has subjecttothresholding set to true. You need the exact user count for a low-traffic page for January 2026. Which table pattern and filters do you use in BigQuery, and why might the result differ from the report?
Show answer
Query events_* with _TABLE_SUFFIX BETWEEN '20260101' AND '20260131', filter event_name = 'page_view', extract page_location from event_params, and use COUNT(DISTINCT user_pseudo_id). The export applies no thresholding, so the low-traffic page appears with its real count. The result can differ from the report because the report counts active users under GA4's definition, may use a different identity (blended or device-based), may strip query strings from the page path, and may include modeled data. The query counts every device that viewed the page.
Exercise
Why does SELECT COUNT(DISTINCT CAST(ga_session_id AS STRING)) give a wrong session count, and what is the fix?
Show answer
ga_session_id is a timestamp of the session start and is unique only within one user, so two users who start sessions in the same second share a value and are merged. It is also an event parameter, so it must be read from event_params with UNNEST. The fix is to extract it from event_params and combine it with user_pseudo_id, for example with CONCAT(user_pseudo_id, '-', CAST(... AS STRING)), then count the distinct combinations.