How to Track Site Search in GA4

In today’s digital world, more and more quantitative and qualitative tools are coming to the front to help us understand what people are doing on our website and why they are doing so.

Thankfully, for us marketers, Google Analytics 4 also has one such feature which is being carried forward from UA, that can help us understand what people are trying to find on our website, i.e. the site search.

Even so, it is often not utilized to the maximum of its ability for us to understand user behavior. In this post, we will go over several topics to help you learn all about tracking site search in GA4.

Master the basics with our FREE GA4 Course for Beginners

Here’s what you would have learned by the end of this blog:

On the other hand, here’s a detailed overview of GA4’s DebugView, another great addition to GA4’s arsenal of features. Now, let’s start learning about GA4 site search tracking. 

What is the Importance of Site Search Tracking?

Your website’s internal site searches can tell you a lot about your site’s visitors, their intent, what they are looking for, and what is or is not available on the website.

Understand what Visitors are Looking for

Whether you have a blog or an eCommerce website, understanding what users are looking for on your website will help you to provide them with the type of content or product they are looking for, as well as optimize your website.

Your visitors can come from paid ads, an organic Google search, or any other source, but the search terms they use on your website can tell you:

  1. Their intent 
  2. Whether you have what they are looking for or not
  3. How the visitors describe your products/content

For instance, a visitor sees an ad for mobile phone accessories and lands on your website.

You can get a good idea about the visitor’s intent based on their source. Taking our example, we can see that they came from a search engine after actively searching for a product, which means they have a high intent of buying it.

However, they still might want to find a specific color phone case for an exact type of model/variant using certain keywords, which will reveal whether you have that product or not and how they describe them in their own language.

Optimize Your Website and UX

Looking at those terms will help you to ensure that visitors can find what they are looking for and that the content/products are relevant to them for a good experience.

Another way to gain trust and improve relevance for your visitors is using their own words on your website, which you can find through the search terms in GA4.

You can also find out if certain keywords are being searched more than others and create more of that content or stock those products, so your visitors don’t go to other websites.

All of this optimization and improvement in user experience is possible if you’re tracking site search terms and analyzing them.

Now that you understand why it is important to track internal search terms, let’s move on to see how we can set it up in GA4.

How to Implement Site Search in GA4?

This is where things might get a little tricky even though GA4 has made it easier to track the search terms. 

By default, site search in GA4 is being tracked if you haven’t turned off the enhanced measurement. 

Let’s find out where you can find site search settings in Google Analytics, understand what they mean, and configure them for your website.

Go to AdminData Streams and select the stream for which you want to set up a site search in GA4. Next, click on the gear icon to view the site search settings.

Enhanced measurement settings under Data streams settings to view Site search in GA4

In the Site search configuration, click on Show advanced settings and you will see two fields for query parameters.

Site search toggled on and advanced settings showing Search Term Query Parameter and Additional Query Parameter fields under Enhanced measurement settings

First, what does Search Term Query Parameter mean? You can see that by default, Google has included the following query parameters here:

  • q
  • s
  • search
  • query
  • keyword

It means that whenever a website visitor performs a search, Google will trigger the view_search_results event as long as the above-mentioned query parameters are present in the URL. Also, note that only the first matching parameter will be used.

For instance, if we search for Google Analytics 4 on MeasureSchool’s website, the URL looks like this:

Showing query parameter “s” in URL on MeasureSchool’s site search

As you can see the letter “s” is present as a query parameter which will automatically trigger the view_search_results event in GA4 and send the search term with the event parameters.

The same event will automatically trigger if other query parameters like q, search, query, or keyword are present in the URL.

To clarify, the query parameter is anything that comes after the question mark “?” symbol in the URL.

What if the query parameter on your site’s URL does not match the default terms, like the following hair dryer search results URL? 

Different search term query parameter than what’s available by default in GA4 site search settings

You can quickly add that parameter with a comma in Search Term Query Parameter (max up to 10 parameters are allowed).

Added searchTerm as query parameter that popped up in our search for hair dryer in the above example

Now you have your GA4 site search set up, but what if there are advanced filters or any other parameters for which you want to track the search terms?

GA4 has a solution for that, as well. Remember seeing the Additional query parameters box above – the one we can use to let Google know that we want to track these parameters as well.

For instance, you want to track the ‘section’ parameter in the below search results URL. 

Additional query parameter of section in the search results URL apart from searchTerm

All you have to do is put in ‘section’ in the Additional Query Parameters box. You can add a maximum of 10 additional parameters.

Adding section as an additional query parameter under the site search settings of enhanced measurement

Once done, save the settings and you will have correctly configured your site search tracking in GA4.

Don’t worry about the upper or lower case when adding the query parameters in the settings, as they are case-insensitive.

There are scenarios where GA4’s built-in functionality might not help, for instance, when there are no query parameters in the URL, auto-complete search, and so on.

This is where GTM kicks in and you can use several methods to send your site search terms to GA4 or even get a developer’s help, but that’s a topic for another day.

Where to Find Site Search Terms in GA4?

As with most things in analytics, configuring settings and sending data to GA4 is one thing, but finding it in different reports where you can use it to analyze is another thing. The same is the case with site search terms.

There are four ways you can find the site search terms in GA4:

  1. Testing in DebugView
  2. Real-time Report
  3. Events Report
  4. Custom Report in Explore

Let’s see how you can view your values with all these methods within the GA4 interface.

Testing in DebugView

DebugView is a great feature that lets us see the details of different events that are coming into GA4 in real-time.

Generally, you won’t need to use this method if your URL has default query parameters.

But if you have added a different query parameter and/or any additional parameters, then you can test whether it is working in DebugView or not.

Once you’re in the debug mode, go to ConfigureDebugView and perform a search on your website.

You can see that the view_search_results event has been triggered. You can click on that event and look at the search_term parameter to find the term you searched for.

Real-time Report

Another place where you can see the view_search_results event and the search_term parameters is under ReportsReal-timeEvent count by Event name card.

Event count by Event name card under Real-time overview to view_search_results event

To view the search terms, simply click the view_search_results event and you will see several parameters. Select search_term. You can now see different search terms and how many times they’ve been searched.

Search_term event under the Event count by Event name card showing the total count, and search terms with their individual counts

While this report gives you a quick overview of the terms, it isn’t very detailed, which brings us to the third method.

Events Report

Since view_search_results is an event, the Events report under Engagement has some more results. Once there, find the view_search_results, which can be at the bottom, and click on it.

Events report under Engagement reports showing the view_search_results event

In this detailed report, you can find all the search terms for any specific time, the Event Count, and the Total Users under the Search_Term card.

Search_Term card under the view_search_results event showing the search terms, event count, and total users found in the Events report of Engagement section in GA4

💡 Top Tip: You can also find other details about the view_search_results event in this report’s other cards like the page location, referrer, country, and gender.

Custom Report in Explore

The problem with the other three reports is that they are somewhat limited and you cannot customize them much. However, creating a custom report in Explore can give us more flexibility and information.

Let’s pick a free-form report from the Explore section and rename it Site Search Report (or whatever name suits you). 

When you start, you will see some segments, dimensions, and metrics added by default. You can remove all of them except the Event name dimension and the Event count metric under the Variables column, like this:

Keeping Event name in dimensions and Event count in metrics in the Variables section of the free form report under Explore

Next, click on the ‘+’ icon on dimensions, type ‘search term’, and click on the Import button.

Add Search term as dimension in the free-form report under the Variables column

In the next part, we will add the Search term dimension under the Rows and Event count metric under the Values of the Tab settings column. You can do it by double-clicking on the dimension/metric or by dragging and dropping it.

Adding Search term dimension under the Rows and Event count metric under the Values of the Tab settings column in the free-form Site Search Report

You will now see a report like this on the right side.

Free-form report showing the search terms and the event counts after adding the Search term dimension under the Rows and Event count metrics under the Values in Tab settings

However, there’s a small problem in the first row, where the Search term is blank and the event count is unusually high. 

We can fix that by applying a filter under the Tab settings column, by using the Event name dimension we had earlier left under the Variables column.

Click on Filters and select Event name.

Filtering with Event name under the tab settings column

Configure the Event name to exactly matchesview_search_results. Click Apply.

Creating and applying the Event name filter with exactly matches condition and using view_search_results as event

Finally, you’re all set to view your Site Search Terms report.

Final free-form report showing the search terms, the event counts, and event count per user after adding the view_search_results event name filter in Tab settings

You can also add other dimensions, metrics, and segments to further analyze your search term report. 

For instance, we added an Event count per user to get an idea of how many users have searched that particular term to get more context.

You can maybe apply a segment for mobile devices or a particular location and see more specific results, but that part is up to you.

Why Are You Seeing Low Site Search Volume?

Now, you’ve set up the site search report in GA4 and are not seeing a lot of site search terms there.

There could be three major reasons for this:

  1. Your site search bar is not visible or tucked away somewhere that is difficult for the website visitors to find it. You might want to bring it right on the top header section, which is a standard most people expect.
  1. Your Search Term Query Parameter is different or changed later on compared to what’s available by default in GA4, and you haven’t added the one that shows in your site search URL in the GA4 settings interface. Adding it in the enhanced measurement site search settings should fix it.
  1. Your site search bar does not function properly or is not even available on the website. This could be fixed from within your CMS, or by having your developer add one.

Other reasons could be that your site search URL has no query parameters for the search results, or the auto-complete functionality makes it difficult for GA4’s enhanced measurement to capture them.

In this case, we can use GTM to send the site search event to GA4 with different methods, a topic for another time.

Summary

We have covered why it is important to track site search in GA4 and how to do it.

You are now aware of how you can add any different search query parameters compared to what’s available in GA4 by default. If you have a bit more advanced site search with filters, then you can track the additional parameters in GA4.

More importantly, you now know how to view the site search terms in the DebugView as well as in three other reports to find the site search terms, including a custom report which you can always customize further with more dimensions, metrics, segments, and filters.

Finally, you learned several reasons for seeing a low site search volume and how some of them can be fixed while others can also be tracked if we unleash GTM’s powers.

If you’re interested in recognizing how far a user has scrolled on a web page to improve the user experience, check out our guide on how to set up scroll tracking in GA4 which we recently published.

Don’t forget to tell us and our readers in the comments if you are tracking site search terms in GA4 and how it affects your understanding of the website visitors and helps to improve their experience.

JOIN US!

Master Data & Analytics with Measuremasters

Exclusive Courses & Workshops | Ongoing Troubleshooting | Support Resources, Tools & much more

Related Posts

guest
3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Ashkan
Ashkan
1 month ago

Thank you for the detailed blog. Can you please make a similar guide but about the live search functionality with AJAX calls? What’s the best way of capturing those search keywords?

Subham
Subham
10 days ago
Reply to  Ashkan

Yes, I also want to do the same (Similar guide but about the live search functionality with AJAX calls).

Subham
Subham
10 days ago
Reply to  Ashkan

Thanks for rising such a topic.

Blog Categories

Want to turn your skills into a profitable investment? Subscribe & Get our FREE Course

How to Sell GA4 FREE Course

now it's time to

Start measuring like a master

Itching to jump into the world of MeasureMasters? This is what you have to look forward to.