How to set up site search in Google Analytics 4 with Enhanced Measurement 

May 22, 2021

Note: This only works for websites that use URL parameters for their site search.

Site search analysis is very interesting for many websites. You can get direct insights into what your website visitors are looking for. This can even help you to identify new product opportunities.

In Google Analytics 4 (GA4), it is very easy to set up site search if your website reloads and displays the search query as a parameter in the URL after your users do a search.

#1 How to check if search tracking with enhanced measurement will work

  1. Go to your website and perform a search
  2. Check if your website reloads after you hit the search button
  3. Check if your URL looks like In this example, “q” is the search parameter, and “search test” is the search term. It doesn’t matter if your search parameter is different. Just make sure your parameter comes after a “?” or “&” character.

#2 Set up site search tracking

After you have ensured that this method will work for your website, you can log in and go to Settings -> select your GA4 Property -> data streams -> and select your web stream. Make sure that Enhanced Measurement is enabled.

Next, click on the gear icon below the toggle and make sure Site search is enabled as well. 

Unter advanced settings, you can specify your query parameter, like “q” in the example above. 

If you have additional query parameters, like language or searched, you can add those as well.

#3 Site search setup testing

Finally, we’ll test that everything works correctly. For that, we enable the DebugView in Google Analytics by using the Google Chrome GA Debugger extension or the Google Tag Manager Preview.

Go to “DebugView” and perform a search on your website in another tab or window. Then you should see that “view_search_results” got triggered.

If you click on the event, you’ll see all tracked details, e.g. the search term.

#4 Site search analysis

Now it’s time to know where you can analyze how your users use your search bar.

The easiest way is to go to Engagement -> Events -> and click on the event “view_search_results”, but there you get only basic information, like how often users do search queries and where they are coming from.

To get more insights, you need to create a report in the analysis hub.

Do you need help?