How to set up Site Search Tracking in Google Analytics 4

One of the most important and overlooked methods of understanding your audience is site search tracking. Knowing exactly what users are looking for on your website can help you make informed decisions about what content and services are the most important to your potential customers.

What is Site Search Tracking in Google Analytics 4?

The ability to track queries that users enter via site search bars has been available for a long time, including in (the soon to be deprecated) Universal Analytics. Site search tracking is the process of recording what search queries users enter when attempting to search on your website.

Search Bar Example
A typical site search bar.

If your website includes any kind of search bar then you should absolutely make sure that site search tracking is enabled in Google Analytics 4. This will allow you to collect that data, add it to your reports and help you understand the intent of your audience more effectively.

Why is Site Search Tracking in GA4 useful?

There are a few different reasons why site search tracking in GA4 is useful to have enabled and set up. Understanding what your visitors are searching for can help you to develop new content or choose a particular focus for your products and services.

Once enabled and implemented, you’ll be able to see what keywords users actually enter into your website search bar. The results may surprise you! While you may see mostly relevant searches, unexpected search terms picked up by site search tracking is also vital data to help you fill any potential gaps in content.

Search Term Examples
User search queries can be incredibly varied.

Depending on what your visitors are searching for, you may wish to consider developing some of the following features of your website:

  • Additional content to relevant pages that users are searching for, such as FAQs
  • Blog posts or new dedicated pages for topics that users search for frequently, that your website doesn’t cover yet
  • Updating service or product pages with new information that would be relevant to the search queries
  • Using the search queries to help decide which products and services are popular to your audience, and run promotions to help push those products
  • What content to highlight or include in your other digital marketing efforts, that your visitors would find relevant based on what they search for

You can also use site search tracking in Google Analytics 4 to find the most popular search queries for your website. With this information it’s possible for you to test your own search results by entering the terms yourself. Based on the results, you could consider:

  • Are the search results relevant to my query?
  • Did I find the answer I was looking for in the first place?
  • Are there any pages appearing in the results that really shouldn’t be there?
  • Does anything look broken or unexpected?

Knowing what your visitors are looking for can put you in their shoes when looking at your website and help you spot areas that can be improved upon.

How to enable Site Search Tracking in GA4

One of the first requirements to enable site search tracking in Google Analytics 4 is to ensure your website actually has a search bar for users to enter search queries. This could be a sitewide bar within the main navigation, or perhaps a localised search for products or blog post content.

By default, Google Analytics 4 will have basic site search tracking enabled if Enhanced Measurement has been switched on for your GA4 Data Stream (which is a default setting available while setting up GA4). This can be found in Admin > Property > Data Streams > Your Website Data Stream.

Enhanced Measurement Options
Site Search can be found within Enhanced Measurement settings.

However, this is the default setting only and tracks a small set of commonly used search query parameters:

  • “q”
  • “s”
  • “search”
  • “query”
  • “keyword”

These are the query parameters that appear in your website URL when a search is performed. For example if searching for “shoes”, a search result may look like “https://www.example.com/?q=shoes” for that search query.

If your website uses a different query parameter (you can do a quick search to find out your own!) then you will need to add it to the site search tracking in GA4.

GA4 Default Query Parameters
The default query parameters, as they appear in GA4.

If your search has additional queries or filters, such as multiple options when searching, then you can also add up to 10 additional queries. This is useful if you have search filters for something like products and want to show results based on a query, price and brand at the same time.

Additional Query Parameters in GA4
Additional parameters can be added, if your search uses filters or multiple options.

However if the site search on your website does not use query parameters, then this default method of site search tracking in Google Analytics 4 will not work. There are others methods to set up site search tracking via Google Tag Manager, which we’ll cover in a future blog post. Sign up to our newsletter to make sure you don’t miss it!

Free Digital Tips Direct to your Inbox!

Be among the first to receive tips, advice and news on all things digital performance related. From new features in Google Analytics, Data Studio and other tools, to interesting articles, videos and more! Completely Free! (Unsubscribe any time you like!)

Mailchimp Signup
Marketing Permissions

How do I view Site Search Queries in GA4 reports?

As we’ve discussed before Google Analytics 4 uses Events for everything, including site search queries and keywords. As site search set up in GA4 is handled by Enhanced Measurement, the default event that is sent containing the query data is called “view_search_results”.

To view this event, you can find it in the following report:

Reports > Engagement > Events > view_search_results

view_search_results Event
The view_search_results event in the GA4 Events report.

This will give you an widget-based overview of the view_search_results event. However you may notice that there doesn’t appear to be any search terms included here. This is because the parameter containing the search query data is not available by default, and needs to be added as a Custom Dimension first, named “search_term”, to be viewable in the report.

To add a custom dimension, navigate back to the Admin section and under Property select Custom Definitions.

Custom Definitions Menu
Custom definitions can be added via Admin > Property.

Here you can create a new custom dimension and provide it with the name “search_term” and the event parameter of “search_term”.

Custom Dimension Example
If a dimension does not yet exist but is recorded, it can be added as a Custom Dimension.

Save the dimension and the parameter will now begin to appear in your GA4 reports, including the Events report for view_search_results.

GA4 Search Terms
Search queries appearing in the GA4 Event report.

It may seem a little convoluted to add this extra step for what should otherwise be a default event via Enhanced Measurement, but this is how Google Analytics 4 currently handles site search tracking. It may change in the future to be a default dimension but for now don’t forget this step to view your visitors search queries!

Share this post!