Glossary

How GA4 Site Search Tracking Records What Visitors Type

Taras Shynkarenko
Taras Shynkarenko
•Updated: •8 min read
How GA4 Site Search Tracking Records What Visitors TypeHow GA4 Site Search Tracking Records What Visitors Type

TL;DR, Quick Answer

8 min read

GA4 site search is the enhanced measurement option that sends a view_search_results event with a search_term parameter when a results page carries one of the query parameters q, s, search, query or keyword. You can add your own parameters in the advanced settings, and extra ones arrive as q_ parameters. search_term already fills the predefined Search term dimension, so you don't register it. Sites that keep the term out of the URL send a search event with search_term themselves.

Google Analytics handles GA4 site search through the Site search option of enhanced measurement, which sends a view_search_results event with a search_term parameter each time a visitor lands on a results page whose URL carries a search query parameter. Google's enhanced measurement page says the event fires "each time a user is presented with a search results page, as indicated by the presence of a URL query parameter." Turn it on, confirm your search URLs use a parameter GA4 recognises, and read the terms in the Search term dimension.

Site search is one of the seven enhanced measurement options, next to scrolls, outbound clicks and file downloads, and it needs no code when your search already puts the term in the URL. When it doesn't, you send the event yourself, as covered further down.

A woman browses running shoes on a laptop, the kind of visitor search that GA4 picks up from the results page URL.

GA4 detects a site search by looking for a known query parameter in the page URL, then copying that parameter's value into search_term. Google lists the five parameters it checks by default:

  • q
  • s
  • search
  • query
  • keyword

A visitor who searches for "running shoes" and lands on /search?q=running+shoes sends view_search_results with search_term set to the typed text. WordPress search uses ?s=, which is on the list. A site whose results page uses ?term= or ?k= sends nothing until you add that parameter.

Google's help page also notes one extra parameter: the event "only sends the unique_search_term parameter when it has a value of 1 (i.e. when the string is unique to that session)." That flag lets you separate first searches from repeats of the same term in one session.

How do you turn on GA4 site search tracking?

You turn on GA4 site search tracking in the enhanced measurement settings of your web data stream, with the Editor role or above. Google's steps:

  1. In Admin, under Data collection and modification, click Data streams.
  2. Click the name of your web data stream.
  3. Under Enhanced measurement, slide the switch on to enable all options.
  4. Open the Site search option to edit it and its advanced settings.

If you use the Google tag, Google adds that "you also need to make sure that each event is enabled for automatic event detection for your Google tag. By default, all event types are enabled." Check both places when the option is on and no view_search_results events arrive. After saving, run a search on your site and watch the Realtime report for the event.

How do you add your own search query parameters?

You add your own search query parameters in the Site search option's advanced settings, and GA4 offers two kinds. Google's page says "You can optionally configure this event to look for other URL query parameters," which covers the parameter that holds the term itself. It also lists optional parameters named "q_", where the key "matches an additional query parameter you specify to be collected under advanced settings."

SettingWhat you enterWhat GA4 sends
Search term parametersThe parameter that holds the typed term, for example termThe value in search_term
Additional query parametersOther parameters on the results URL, for example categoryThe value in q_category

The second kind is useful for filters. A store whose results URL reads /search?term=jacket&category=women can keep the term in search_term and the filter in q_category. Google's enhanced measurement page does not state how many additional parameters the field accepts, so enter only the ones you plan to report on.

Do you need to register search_term as a custom dimension?

No, you don't register search_term as a custom dimension, because GA4 already maps it to a predefined dimension. Google's enhanced measurement page states "The search_term parameter populates the Search term dimension," and the dimensions reference describes Search term as "The term used to search your website or application." Google's custom dimensions page warns that registering a parameter "that is already a predefined dimension" is "not a best practice," since "it will use one of your custom dimension quota."

The q_ parameters are different. They are your own event parameters, so they need an event-scoped custom dimension before reports and explorations can show them. Create one per parameter in Admin under Data display, Custom definitions, using the exact name, such as q_category. Pick only filters you will act on, and use the guide to choosing dimensions from the decisions they inform to decide which ones earn a slot.

An analyst studies data on a laptop at a desk, like reading search terms in a free-form exploration.

Where do you see GA4 search terms?

You see GA4 search terms in the Search term dimension, and the fastest way to read it is a free-form exploration. Build it like this:

  1. Open Explore and start a blank free-form exploration.
  2. Add the Search term and Event name dimensions, and the Event count and Total users metrics.
  3. Drag Search term into Rows and the two metrics into Values.
  4. Add a filter where Event name exactly matches view_search_results.

Sort by event count to see what visitors look for most. Then look for terms your site has no page for. A term that keeps returning is content you should write or a product you should stock. Search terms also pair well with event tracking on the results page, such as a click on a result, so you can tell searches that found something from searches that ended in an exit.

Flowsery
Flowsery

Start Your 14-Day Free Trial

Real-time dashboard

Goal tracking

Cookie-free tracking

How do you track searches when the term is not in the URL?

You track searches without a URL parameter by sending the event yourself with the term in search_term. Search boxes that post a form, load results with JavaScript, or use a path such as /search/shoes give enhanced measurement nothing to read. Google's recommended events reference defines a search event with one required parameter, search_term, and gives this example:

gtag("event", "search", { search_term: "t-shirts" });

Fire it from the code that runs the search, at the moment results appear, with the text the visitor typed. In Google Tag Manager, send the same event name and parameter from a GA4 event tag triggered by your search code. The Search term dimension accepts both routes: Google says to populate it "by sending the search_term parameter with the search or view_search_results event." Keep the two apart in your filters if you run both, or each search counts twice.

To count searches as a success metric, mark the event as a key event. The difference between key events and the older conversions label is in key events vs conversions in GA4.

Which route sends your site searches
1
Check the results URL. Run a search on your site and look for the term in the address.
2
Parameter on the list. With q, s, search, query or keyword, enhanced measurement sends view_search_results.
3
Another parameter. Add it in the Site search advanced settings, for example term.
4
No term in the URL. Send a search event with search_term from your own code.
Both routes fill the Search term dimension.

Can GA4 search terms contain personal data or be thresholded?

GA4 search terms record whatever visitors type, so they hold personal data whenever someone types an email address, a phone number or an order ID into your search box. Google puts the duty on you: "You're required to ensure that no personally identifiable information is collected." If your search accepts that kind of input, strip it in your own code before the tag reads the URL, or send a cleaned term with a manual event.

Thresholds are the second limit. Google's data thresholds page says "If a report or exploration includes search query information, the row containing that data may be withheld if there aren't enough total users." Rare terms are the ones that disappear, and the guide to GA4 data thresholding explains how to spot the Data quality indicator and which changes Google says reduce withholding.

How does Flowsery count site searches?

Flowsery counts a site search as a custom goal that you name and send with one call, such as window.flowsery("search"), the syntax in Flowsery's custom goals docs. Its goal and event tracking page describes custom events for "any user action," goals with completion rates over time, and a real-time event feed to "debug and validate your tracking instantly." Flowsery funnels let you "select the pages or events that make up your conversion path," so a search event can sit as a step between a landing page and a signup. Flowsery's product pages do not list a search term report, but a goal can carry the typed term as a custom parameter, such as window.flowsery("search", { term: "running shoes" }). The docs allow a maximum of 10 custom parameters per event and string values of at most 255 characters, and the Goals card shows a breakdown of each parameter value and how many visitors matched it. The personal data rule above applies here too, so strip email addresses and phone numbers from the term before you send it.

Frequently asked questions

Is GA4 site search on by default?

Google's help page does not state a default for the Site search option. It says you slide the Enhanced measurement switch on to enable all options and click to edit individual ones. Open your web data stream to see the current state.

Which URL parameters does GA4 site search recognise?

By default, GA4 looks for q, s, search, query and keyword. You can configure the event to look for other URL query parameters in the Site search advanced settings. Any parameter not on the list sends no event.

What is the view_search_results event in GA4?

It is the event enhanced measurement sends when a visitor sees a search results page, as shown by a search query parameter in the URL. It carries the typed text in search_term. It also sends unique_search_term with a value of 1 when the term is unique to that session.

Why is my GA4 Search term dimension empty?

The Site search option is off, the event is disabled for automatic event detection in your Google tag, or your search URL uses a parameter GA4 does not check. Search boxes that keep the term out of the URL send nothing either. Add the parameter in advanced settings or send a search event with search_term.

They are the additional query parameters you list in the Site search advanced settings. GA4 sends each one as q_ plus the parameter name, such as q_category. Register each one as an event-scoped custom dimension to report on it.

Should I use the search event or view_search_results?

Use view_search_results when enhanced measurement can read the term from your URL. Send the recommended search event with search_term when it cannot. Both populate the Search term dimension, so avoid sending both for the same search.

You need the Editor role or above. Open Admin, click Data streams, choose your web data stream and edit the Site search option under Enhanced measurement.

How do I find the most searched terms in GA4?

Build a free-form exploration with the Search term and Event name dimensions and the Event count metric. Put Search term in Rows, filter Event name to exactly match view_search_results, then sort by event count. A term that keeps returning with no matching page shows what to write or stock.

Why are some GA4 search terms missing from my report?

Google withholds a row that includes search query information when there aren't enough total users. Rare terms disappear first. The Data quality indicator tells you when this is happening.

Flowsery
Flowsery

Start Your 14-Day Free Trial

Real-time dashboard

Goal tracking

Cookie-free tracking

Does Flowsery show which words visitors search for?

Flowsery's product pages do not list a search term report. You can send each search as a custom goal with the term as a parameter, such as window.flowsery("search", { term: "running shoes" }), and the Goals card shows a breakdown of each term and how many visitors matched it. A funnel then shows whether those visitors convert afterwards.

Was This Article Helpful?

Let us know what you think!

See us more often in Google

One click marks Flowsery as a preferred source, so our articles sit higher in your Top Stories, AI Mode, and AI Overviews.

Before you go...

Flowsery

Flowsery

Revenue-first analytics for your website

Track every visitor, source, and conversion in real time. Simple, powerful, and cookie-free.

Real-time dashboard

Goal tracking

Cookie-free tracking

Related Glossary Terms

Related Articles