Guide 129 · Setup · GA4 + Tag Manager
Turn on site search tracking: the five query parameters that trigger view_search_results
Site search tracking watches the URL, not the search box. When a visitor reaches a results page whose URL carries a search query parameter, GA4 fires view_search_results with the search term attached. Google watches five parameters by default — q, s, search, query, and keyword — and the stream settings accept more. This guide confirms the toggle and adds a custom parameter where the site needs one.
After step 4, a search on the site whose results URL carries a watched parameter sends one view_search_results event, and the Search term dimension shows the exact term typed.
Download the reference: the site search reference (JSON) (783 bytes, MD5 e9551c24c684895d3d960ff5a146f85d). The site search parameters from Google's enhanced measurement page, counted in Python: 5 defaults, plus 1 custom parameter in the worked example = 6 watched.
What you need
- A web data stream. Enhanced measurement applies to web streams, and Site search is one of its options.
- The Editor role or above at the property level. Google requires Editor or above to enable or disable enhanced measurement events.
- The site's search URL. Run one search on the site and look at the address bar: the parameter after the question mark is the one GA4 must watch.
The trace
- Open the stream. In Admin, under Data collection and modification, click Data streams, then click the name of the web data stream.
- Open the enhanced measurement options. Under Enhanced measurement, click the settings icon to edit individual options.
- Check Site search. Confirm the Site search option is on. It is on by default when the stream is created. Save if you changed anything.
- Check the five default parameters. By default, the event triggers on the presence of one of 5 query parameters in the URL: q, s, search, query, and keyword. If the site's search results URL uses one of those five — for example
?q=boots— nothing more is needed. - Add a custom parameter when the site needs one. If the site's search uses a different parameter, add it under the advanced settings for Site search. In the worked example the site searches with
?terms=boots, so one custom parameter is added and the watched count becomes 5 + 1 = 6 parameters: q, s, search, query, keyword, and terms. Each added parameter is collected as its own q_ parameter, sotermsarrives asq_terms. - Find the event in the reports. Open Reports, then Engagement, then Events, and look for
view_search_results. The search_term parameter fills the Search term dimension. Standard reports can take 24 to 48 hours to show new data; Realtime and DebugView show the event sooner.
Dead ends
DEAD END — SEARCHING FROM A FORM THAT NEVER CHANGES THE URL. The event triggers on a URL query parameter. If the site's search runs without ever putting the term in the URL, no view_search_results event fires, however many searches visitors run. The fix is a search that writes the term into the URL, or custom event tracking.
DEAD END — ADDING THE PARAMETER BUT SPELLING IT WRONG. The parameter must match the URL exactly, including case. A setting for Terms watches nothing when the site writes terms. Copy the parameter from a real search URL on the site.
DEAD END — EXPECTING EVERY SEARCH TO COUNT ONCE. Google only sends the unique_search_term parameter when its value is 1, meaning the string is unique to that session. Repeated identical searches in one session do not each count as a unique term.
End state
Site search is on, the site's search parameter is watched, and each search results page sends one view_search_results event with the typed term in the Search term dimension. The default five parameters plus any custom ones are all listed in the stream settings.
Sources
- Analytics Help — Enhanced measurement events — the Site search option: the 5 default query parameters, adding other parameters under advanced settings, the search_term parameter, and the unique_search_term rule
Checked 11 November 2026. The parameters and the trigger above are the ones in Google's enhanced measurement page, opened 11 November 2026. No step in this guide was run inside a live Analytics property, because that needs a Google sign-in and this site does not sign in as anyone. The reference file was checked in Python: its figures were recomputed from the documentation values and match the numbers on this page. Google moves menu items without warning; if a path on this page no longer matches, the linked help page is the current map.