In short. Retain the collected page_location string from the first ordered page_view in each identified session, including the query parameters present in that value.
Definition: A landing URL is the page address associated with the first pageview in a session. In Google Analytics 4 (GA4) BigQuery exports, retaining it means extracting the collected
page_locationstring from that pageview's event parameters and preserving its query string.
Key facts
As of 17 October 2026, Google's documentation describes these fields and selection rules:
- Google's BigQuery export schema stores string event parameters, including URLs, in
event_params.value.string_value. - The Landing page report defines its landing page dimension from the path and query string associated with the first pageview in a session.
- Google's session documentation recommends combining a user identifier with the session ID for session identification outside Analytics.
- The pageview documentation gives
location.hrefas the defaultpage_location, excluding the URL fragment after#.
Which value preserves the URL parameters?
The pageview documentation defines page_location as the page URL. An override must start with the protocol and contain the full URL. The query below returns that collected string unchanged as landing_url, preserving any query parameters present in it.
Google's export schema places event parameters in the repeated event_params record. A scalar subquery selects the page_location key and reads its string_value. Extracting a path or removing the text after ? would discard part of this value.
How is the session entry pageview selected?
Google's session documentation explains that ga_session_id derives from the session's start timestamp in seconds. This example groups by user_pseudo_id and ga_session_id, with stream_id added to keep streams separate. It selects page_view events to follow the landing-page definition.
Google's basic query examples order pageviews using batch_page_id, batch_ordering_id and batch_event_index. This adaptation uses that sequence within each session, followed by event_timestamp as an additional ordering field. The table name is a placeholder; the dates reuse Google's illustrative scan range.
WITH pageviews AS (
SELECT
stream_id,
user_pseudo_id,
event_date,
event_timestamp,
batch_page_id,
batch_ordering_id,
batch_event_index,
(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
FROM `PROJECT.DATASET.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20240718' AND '20240731'
AND event_name = 'page_view'
AND platform = 'WEB'
), ranked AS (
SELECT *,
ROW_NUMBER() OVER (
PARTITION BY stream_id, user_pseudo_id, ga_session_id
ORDER BY batch_page_id, batch_ordering_id,
batch_event_index, event_timestamp
) AS entry_row
FROM pageviews
WHERE user_pseudo_id IS NOT NULL
AND ga_session_id IS NOT NULL
)
SELECT
stream_id,
user_pseudo_id,
ga_session_id,
event_date AS entry_date,
page_location AS landing_url
FROM ranked
WHERE entry_row = 1;
GoogleSQL's numbering functions reference defines ROW_NUMBER as a sequential ordinal within an ordered partition. Rows tied on every ordering field have nondeterministic selection. This query excludes events missing a grouping identifier and preserves a null URL on the selected entry row.
What should be checked before retaining the result?
The export schema names daily tables events_YYYYMMDD and documents updates for late events for up to three days after the event date. A stored landing table therefore needs refreshes for those dates. The query selects the earliest pageview within the scanned tables; including a session's actual entry requires a scan that reaches its beginning.
Google's data redaction documentation describes processing before collection. The web stream's Redact data setting includes Preview redacted data for checking its effect. Parameters removed before collection cannot be recovered by this SQL.
Related terms
- URL parameters
- UTM parameters
- How do I compare landing pages for AI assistant visits in GA4?
- Where is the page referrer stored in a GA4 BigQuery export?
FAQ
Should I select the first event of any type?
Use the first page_view to match the definition in Google's Landing page report. The SQL filters event type before assigning row numbers.
Why does my result contain a null landing URL?
The query retains the selected pageview even when its extracted page_location is null. Google's query examples show how to list available event parameters; you can use that list to inspect the exported keys.
Does the default page URL retain its fragment?
Google's pageview documentation says the default excludes the fragment. It also requires a full URL, including the protocol, when you override page_location.
Sources
- Google Analytics, "[GA4] BigQuery Export schema", undated
- Google for Developers, "Measure pageviews", undated
- Google Analytics, "[GA4] Landing page report", undated
- Google Analytics, "About Analytics sessions", undated
- Google for Developers, "Basic queries for Google Analytics event data export", 15 June 2026
- Google Analytics, "[GA4] Data redaction", undated
- Google Cloud, "Numbering functions", 13 October 2026
Check how a page reads to answer engines. Open the GEO score analyzer