In short. Extract page_referrer from event_params by matching its key and selecting value.string_value.
Definition: In a Google Analytics 4 (GA4) BigQuery export, the page referrer is an event parameter with the key
page_referrerinside the repeatedevent_paramsrecord. Its URL is stored in the matching parameter'svalue.string_valuefield.
Key facts
- As of October 2026, Google's BigQuery Export schema shows
page_referreralongsidepage_locationin apage_viewevent example. - Google's configuration reference defines
page_referreras a URL identifying the referral source that brought traffic to a page; its default isdocument.referrer. - BigQuery's array documentation defines an array as an ordered collection of values and explains that
UNNESTreturns a row for each element. - BigQuery's subquery reference states that a scalar subquery, a nested query returning a single value, returns
NULLwhen it finds zero rows.
How is the referrer extracted for each page view?
Google's query cookbook uses a nested SELECT over UNNEST(event_params) to retrieve a named parameter. The following adapted GoogleSQL query selects value.string_value for the page_referrer parameter of each page_view event:
SELECT
event_date,
event_timestamp,
user_pseudo_id,
(
SELECT ep.value.string_value
FROM UNNEST(event_params) AS ep
WHERE ep.key = 'page_referrer'
) AS page_referrer
FROM `PROJECT_ID.analytics_PROPERTY_ID.events_YYYYMMDD`
WHERE event_name = 'page_view';
The table identifier is a template. PROJECT_ID represents the BigQuery project, PROPERTY_ID the Analytics property ID, and YYYYMMDD the daily table's date. Google's export schema documents the dataset name analytics_<property_id> and the daily table name events_YYYYMMDD.
Under BigQuery's scalar subquery rules, a missing matching parameter produces NULL while retaining the outer event row. Multiple matching parameters cause a runtime error.
How can the stored parameter values be inspected?
BigQuery's array guide describes using a correlated CROSS JOIN to expand an array belonging to each source row. This adapted query exposes the referrer parameter records directly:
SELECT
e.event_timestamp,
e.event_name,
ep.key,
ep.value.string_value AS page_referrer
FROM `PROJECT_ID.analytics_PROPERTY_ID.events_YYYYMMDD` AS e
CROSS JOIN UNNEST(e.event_params) AS ep
WHERE ep.key = 'page_referrer';
Here, the output contains a row for each matching parameter. Events without that key contribute no output rows. This query includes matching parameters across event names; the earlier query restricts the selection to page_view.
How does the referrer relate to acquisition source?
Google's configuration reference says the referrer value also contributes to computing traffic source. It documents both a global setting and a stream-specific setting for page_referrer, so the collection configuration can supply this value explicitly.
The export schema separately defines traffic_source as the source that first acquired the user. Its session_traffic_source_last_click record contains last-click attributed session traffic source data across Google ads and manual contexts, where available. A query selecting page_referrer reads the event's stored referral URL; session attribution has its own record.
Related terms
- HTTP Referer header
- Referrer-Policy
- How do I query AI referral sessions in the GA4 BigQuery export?
- How do I retain landing URLs and their parameters in GA4 BigQuery?
FAQ
Can I assume every event contains this parameter?
Google's schema documentation says the set of event parameters is unique to each implementation. You can use the inspection query to see which events carry page_referrer in the selected table.
Which field should I select for the referrer URL?
Select value.string_value from the parameter whose key equals page_referrer. Google's configuration reference specifies a string URL for this field and uses document.referrer as its default.
Sources
- Google Analytics Help, "BigQuery Export schema", undated
- Google for Developers, "Configuration", 5 October 2026
- Google Cloud, "Work with arrays", 13 October 2026
- Google Cloud, "Subqueries", 13 October 2026
- Google for Developers, "Basic queries for Google Analytics event data export", 15 June 2026
Check how a page reads to answer engines. Open the GEO score analyzer