Site Search Settings Google Analytics 4 (GA4)

Google Analytics 4

Google Analytics 4 Site search settings are configured in your Data Streams.

Even though view_search_results is an enhanced measurement event, it’s worth making sure yours is properly configured.

Here’s how to check the GA4 settings for tracking searches on your site.


1. Google Analytics 4 Site Search Settings

2. GA4 Site Search Advanced Settings

Google Analytics 4 Site Search Settings

To check on your site search settings, find your GA4 Data Streams in the property column of the Admin section of your account.

Click on your Web data stream. It should have a globe-looking symbol next to it.

Google Analytics 4 Web Data Stream

Hopefully the popup indicates that your enhanced measurement events are being activated. If so, you’ll see a white checkmark inside a blue circle switched to the right.

Google Analytics 4 Enhanced Measurement Events Settings

Now click on the settings cog on the bottom right. As you can see, Site search is included in the enhanced measurement events.

Google Analytics 4 Enhanced Measurement Events Details

If the check mark across from Site search is to the right and encircled in blue, you should be good to go.

But let’s not take anything for granted. To make sure Google Analytics 4 is accurately collecting our site search data, we need to look at the advanced settings.

Also see: Google Analytics 4 Site Search Report

GA4 Site Search Advanced Settings

Just like events have parameters, so do search queries. Parameters are additional bits of information that tell us more about the search.

There are two types of broad categories for parameters in the Site search (view_search_results) event: search term query parameter and additional query parameters.

Let’s look at both.

Search Term Query Parameter

Picking up where we left off above, in the enhanced measurement events screen, click on “Show advanced settings” in the Site search row.

If you haven’t previously changed anything in your dashboard, you should now see this:

Google Analytics 4 Site Search Advanced Settings

In most cases, you won’t have to change anything for your Site search event to collect data in your dashboard. Here’s how to do a test to be sure.

Search for something – anything – on your website (or mine). Now look at the backend of the URL.

Google Analytics 4 site search test on bradgerick_com

In this search on my site, I entered “custom dimensions” in the search bar. (You can find the search bar it in the footer of the site if you want to test for yourself.)

The URL structure for searches on my site is[search+term]. You can see this at the very top of the previous screenshot.

Looking at one more example, the New York Times URL structure for searches is:

In the Google Analytics 4 site search advanced settings, we see that there are five possible search term query parameters: q,s,search,query,keyword.

We also see that “Only the first matching parameter will be used.”

In the case of URLs for searches on my site, there’s only one parameter, and it’s “s”. That means Google should capture the data.

Same for the Times, which uses “query.”

If I use DebugView while performing a search on, I can confirm that the search_term parameter is “custom dimensions” – the same term for which I searched – within the view_search_results event.

Google Analytics 4 view_search_results event search_term parameter

This means that the way the site search event is set up by default captures everything I need for my site.

There is no need to make any changes.

What if my site search parameter isn’t included by default in GA4?

If you perform a search on your site, and you see a different parameter in the URL for some reason, you should tell Google what this is in your advanced settings.

For example, imagine that the URL parameter for searches on my site was abcxyz like in this screenshot where I deliberately changed the URL:

Google Analytics 4 site search URL with custom parameter

If this really were the search parameter for my site, I would need to change my Search Term Query Parameter to abcxyz.

Just like above, to do this I would go to Admin > Data Streams > Enhanced Measurement Settings > Site search event advanced settings.

Then I would replace q,s,search,query,keyword with abcxyz. It would look like this:

Google Analytics 4 site search event advanced settings custom query parameter

After saving the setting, this would begin to collect site search data.

Site Search Additional Query Parameters GA4

The second field in GA4 site search advanced settings is for additional query parameters. As you can see, you’re allowed to have up to 10.

But what is an additional query parameter for a website search?

If I search for shoes on Zara and I click the men’s section, this is what the URL looks like.

Google Analytics 4 search parameter query example zara website

The highlighted portion at the end is an additional search parameter: section=MAN.

This means that they would want to put “section” in the second field of advanced search settings.

But is Zara ready to go now? Take one more look at the link. Did you notice the part in yellow?

Their site’s search parameter query is searchTerm, which is not included by default in GA4.

So just like we changed it to abcxyz in my made-up example above, Zara would have to change their GA4 site search query parameter setting.

Along with the additional query parameter change, this is what Zara’s advanced Site search settings should look like:

Google Analytics 4 additional parameter query example zara website

Remember, you can have up to 10 additional query parameters, so be sure to include them all. Also note that additional query parameters in Google Analytics 4 a case-sensitive.

Seeing Site Search Parameters in GA4 Reports

Any Google Analytics 4 event custom parameter you want to see in your data must first be created as a custom dimension.

By default, search_term is included as a view_search_results parameter, so you do not need a custom dimension.

Any additional search query parameters, however, do need a custom dimension.

Also see:
Google Analytics 4 Custom Dimensions Limit
Delete Custom Dimension Google Analytics 4

Your custom parameter should match anything you entered in “additional query parameters” in your advanced Site search event settings.

When creating a custom parameter, follow this schema:

Name the parameter: q_<additional key=””>

Between the quotation marks, write the exact name of the additional query parameter from your Site search event advanced settings.

For example, if we return to the example from Zara’s website, this is how we would configure the custom parameter: q_<additional key=”section”>

The data associated with that parameter will then be collected for use in your site search reports every time the view_search_results event is fired.

Leave a Reply