Site Search in GA4
In this guide, you will learn what site search is and how to set it up in GA4.
What is the site search tracking in GA4?
Site search tracking in Google Analytics 4 (GA4) allows you to see how people use the search function on your website. When you enable site search tracking, you can see what terms people are searching for, how many searches are performed, and what pages people land on after searching.
Why it is important to track site searches?
Tracking site searches is important because it can provide valuable insights into how people use and interact with your website. By seeing what terms people are searching for, you can better understand their needs and interests, and tailor your website content and design to better meet those needs.
Site search data can also help you identify issues or problems that people are having when using your website. For example, if you see that a large number of people are searching for a particular product or service that you offer, but they are not finding it easily on your website, you can use this information to improve the organization and navigation of your website to make it easier for people to find what they are looking for.
In addition, tracking site searches can help you identify opportunities to improve the relevance and quality of your website content. By seeing what terms people are searching for, you can determine what topics and information are most relevant and important to your audience, and create more content that addresses those topics.
Overall, tracking site searches can provide valuable insights into how people use and interact with your website, and can help you identify opportunities to improve the user experience and increase engagement on your website.
How does GA4's website search tracking function?
In Google Analytics 4 (GA4), site search tracking works by firing an event view_search_results’ and capturing data about the search terms that people use on your website and the pages that they land on after searching.
Once site search tracking is enabled, you can view the site search data in the “Engagement” report in the “Events” section of GA4. This report will show you the search terms that people are using, the number of searches performed, and the pages that people land on after searching. You can use this data to understand what people are looking for on your website and how to improve the search function to better meet their needs.
How to track site searches in GA4?
Follow these simple steps below:
STEP 1: Go to the website where you want to install GA4’s site search tracking.
STEP 2: Use your website’s search function by typing a search word into the box.
STEP 3: From the URL of the search result page, take note of the search query parameter.
Here, ‘search’ is the search query parameter.
STEP 4: Go to your GA4 property.
STEP 5: Go to Admin.
STEP 6: Go to the “Data Streams” tab in the GA4 property for your website.
STEP 7: Select the data stream you want to enable site search tracking.
STEP 8: Enable the “Enhanced measurement” feature.
STEP 9: Scroll down to the “Site Search” section and toggle the “Site Search” switch to “On”.
STEP 10: Click on “show advanced settings” under the site search.
You will be now able to see the advanced settings for site search.
STEP 11: Enter the query parameter used to pass search terms to your website’s search function. This is typically q, s, search, query, keyword but it could be something else.
You would need to define a custom parameter to fire the ‘view search results’ event if your website has a search term query parameter that is not one of the standard parameters supported by GA4.
For instance, if your website includes the search word as the ‘st’ parameter in its URL:
https://www.tabperformance.com/searchresults.asp?st=talon
thereafter, you must type the parameter “st” in the textbox below ‘Search Term Query Parameter’.
If you want to gather extra URL query parameters when the ‘view search result’ event happens, enter the query parameters in the textbox under ‘Additional Query Parameters’.
The search URL below, for example, includes an additional query parameter called ‘Submit’:
https://www.tabperformance.com/searchresults.asp?Search=talon&Submit=xyz
If you want to collect values from the ‘submit’ query parameter when the ‘view search results’ event occurs, add the ‘submit’ parameter to the text box under ‘Additional Query Parameters’.
STEP 12: Click Save.
STEP 13: Go to ‘Custom definitions’ under property settings in the admin section.
STEP 14: Click on ‘Create custom dimension’.
STEP 15: Type the dimension name and Event parameter as ‘search_term’.
Click save.
When you record the parameter ‘search term’ as a custom dimension, a new data card is added to various event reports in GA4.
Let’s view this data card now.
STEP 1: Navigate to the Engagement under Life cycle.
STEP 2: Click on Events.
STEP 3: Search for ‘view_search_results’ and click on the event name.
Now, you can see the report for event ‘view_search_results’.
STEP 4: Scroll down until you see a data card named as ‘search_term’.
Here is the data for all the search terms used on your website.