Tracking site search in Google Analytics 4 is often neglected due to a lack of knowledge about how to set it up or use it. If you start utilizing site search now, you’re about to explore a new way to see how users interact with your website. This information is essential for optimizing content and enhancing user experience.
Site search tracking involves observing the search terms that users enter into your website search function. This information reveals user intent, highlights content gaps, and identifies areas for improvement to make content more relevant to the user. So, by utilizing this, you can effectively track and analyze site search behavior.
Table of Contents
Set up Site Search Tracking
Site search in Google Analytics 4 is being tracked by default if you haven’t turned off enhanced measurement. We’ll show you how to find site search settings in GA4, learn what it means, and configure it for your website.
In GA4– Head to Admin section (Gear icon located in the lower left corner) then go to Data streams– Choose the stream
Now click on the gear icon to view the site search settings.
Click on Show advanced settings in the site search setup to see two fields for query parameters.
Google Analytics 4 has included some Search Term Query Parameters by default. These parameters are q, s, Search, query, and keyword.
This means that whenever a website visitor performs a search, GA4 will trigger the view_search_results event as long as the query parameters mentioned above are present in the URL. The first matching parameter will be used.
Check this example. If we search for GA4 on debugaroo’s website and Sweater on another website, the URL looks like this:
In debugaroo’s example, “s” is a query parameter that triggers the view_search_results event in Google Analytics 4 and sends event parameters with the search term included.
It’s the same thing with the sweater example; an event will trigger because of the q query parameter. Same thing if another website uses a search, query, or keyword in the URL.
“But wait, I do not have query parameters on my website that match the default terms?”
No worries, do this.
Let’s say you own this awesome website and want to track site searches. You add the query in
Add the query parameter with a comma in the Search Term Query Parameter and add up to 10 parameters.
Check If Site Search Tracking Works
To see if Google Analytics 4 works, you must enable DebugView. There are several ways to do this, and you can read more about how to enable DebugView in this GA4 Setup article.
Once enabled, go to your website, enter a query in the search area, and hit enter. Your search term will appear as one of the URL parameters (query parameters) in the URL.
Now, go to GA4’s DebugView, and soon, you should see an event called view_search_results. Enhanced measurement automatically sent this.(You can read more here about automatically collected events with enhanced measurement enabled.) Click the view_search_results event and then click the search_term parameter. It should contain the word(s) you entered in the site search field.
How do you find Site Search terms in reports?
We will focus on two ways to find search terms in the reports.
The first way to find search terms
Is via the engagement report. There, you can filter out the view_search_results event. Click on the event to get to the overview page, but there, you can only see search terms from the last 30 minutes.
We think the most straightforward way to see search terms in the standard report is to create a detailed report.
Go to the library at the bottom left. Click on Create Report and select Detailed Report.
Start with a blank report.
Add a new dimension. Type search and choose seach_term. Then add the metric you want to see, e.g., event count, sessions, etc.
Then you can hide the one chart if you wish to, scroll down, and the search terms will appear here. Filter the event to show only View_Search_results.
Then click save and go back to the library. We will add it to the standard reports to allow easy access to the search terms report. In this example, we add the report to the life cycle collection, but of course, you can put it anywhere you want. Click on edit collection. Enter “search term,” drag the report from the right, and choose where you want it on the left. Save and select “save to current collection.”
Enter “search term,” drag the report from the right, and choose where you want it on the left. Save and select “save to current collection.”
Go back to the report overview, and you will now see your search terms report under the life cycle collection (or whatever collection you chose)
The second way to find search terms in GA4
We recommend creating a search terms report in the explore section as it gives more flexibility. Click on explorations and select free form.
Click on dimensions and find the search term, select and click confirm/import.
Then, you click on metrics and choose what suits you. In the example, we select active users and event count. Double-click or drag search terms in the dimension column on the left to bring them into the report; do the same for metrics.
At the bottom of the right-hand column, you can filter which event you want the report to be based on. Select the event name, choose the exact matches and view_search_results.
Done. Now you know how to find the search terms in GA4. Great job!
We have covered why tracking site search in GA4 is important. You are now familiar with how to add search query parameters other than those available by default in Google Analytics 4 and how to debug them. Probably the most important: you now know how to view the site search terms in the standard reports and exploration report, which can give you insight about your website traffic’s search behavior. See you soon!