GA4 Site Search – Tracking Site Search in Google Analytics 4

Last Updated: February 3, 2023

What is GA4 site search tracking?

Through the GA4 site search tracking feature, you can determine the search terms used by your website visitors to find information on your website:

site search

What is the advantage of implementing site search tracking in GA4?

Once you have implemented site search tracking in your GA4 property, you can see the list of keywords (called ‘Search terms’) used by your website visitors to find information on your website:

list of search terms

This insight can help you in finding new content development opportunities. 

Let us suppose you discovered that a lot of website visitors are searching for the keyword ‘enhanced ecommerce tracking’ on your website. 

Let us also suppose that you do not have any article on ‘enhanced ecommerce tracking’ on your website. 

In that case, you can publish a brand new article on ‘enhanced ecommerce tracking’ and can thus satisfy the website visitors’ query.

What is required in order to set up site search tracking in GA4?

If you do not have a site search feature (aka the search box, the internal search engine) installed on your website, then you won’t be able to benefit from the site search tracking feature in GA4. 

So you need to have the site search feature on your website.

GA4 automatically tracks site searches (in most cases) once you have enabled Enhanced Measurement Tracking in your GA4 property:

enhanced measurement

However, there could be a situation in which the site search feature is installed on your website in such a way that the default site search tracking feature provided by GA4 won’t work for you.

In that case, you would need to use GTM (Google Tag Manager) to set up site search tracking in your GA4 property. 

For example, 

If you have the site search feature installed on your website, but the search term does not appear in the query parameter, then you won’t be able to benefit from the default site search tracking capability of GA4. 

Here is what I meant by the search term appearing in the query parameter:

query paramter

Here, the query parameter is the part of the URL which comes after the ‘?’ character.

So the query parameter is:

s=utm+parameters

Following is the search term used in the query parameter:

utm+parameters

If you have the site search feature installed on your website, but the search term does not appear in the query string, then you would have to use GTM to set up site search tracking on your website.

Alternatively, you can ask your web developer to configure the URLs of search result pages in such a way that it shows the search terms in the query string.

How does the site search tracking work in GA4?

By default, GA4 fires the ‘view_search_results’ event when a user inputs a query and clicks on the search button on your website. 

As the event gets fired on the website, Google sends a few default parameters, such as search_term, page_location, and source. You can see these parameters in real-time in the GA4 Realtime report.

How to set up site search tracking in Google Analytics 4 (GA4)?

Follow the steps below:

Step-1: Navigate to the website for which you want to set up site search tracking in GA4.

Step-2: Use the search feature of your website by entering a search term in the search box:

enter search term

Step-3: Note down the search query parameter from the URL of the search result page:

note search query parameter

Here ‘s’ is the search query parameter

Step-4: Navigate to your GA4 Property. 

Step 5: Click on the ‘Admin’ link available in the left-hand side reporting menu:

admin link

Step-7: Click on ‘Data Streams’ under the ‘Property’ column:

data streams

Step-8: Click on the web data stream for which you want to set up site search tracking in GA4:

web data stream

Step-9: Make sure that the ‘Enhanced Measurement’ featured is enabled:

enable enhanced measurement

Step-10: Click on the gear button under ‘Enhanced measurement’ to access the settings menu:

enhanced measurement settings

Step-11: Make sure that the ‘Site Search’ feature is enabled:

enable site search

Step-12: Click on the link ‘Show advanced settings’ under the ‘Site search’

show enhanced settings

You should now be able to see the advanced settings for the ‘site search’ feature:

search term query parameter

Though site search is automatically tracked in GA4, it will only work on default query parameters defined by Google: q,s,search,query,keyword

google query parameters

If your website uses a search term query parameter which is not one of the default parameters supported by GA4, you would need to configure a custom parameter to fire the ‘view_search_results’ event.

For example, if your website uses the ‘st’ parameter in its URL to capture the search term:

https://www.optimizesmart.com/?st=utm+parameters

then you should enter the ‘st’ parameter in the text box below ‘Search Term Query Parameter’:

add search term query parameter

If you want to collect values from additional URL query parameters when the ‘view_search_results’ event occurs, then you should add the query parameters in the text box under ‘Additional Query Parameters’:

additional query parameters

For example, the search URL below contains an additional query parameter called ‘title’:

https://www.optimizesmart.com/?st=utm+parameters&title=best+excel+charts

Now, if you want to collect values from the ‘title’ query parameter when the ‘view_search_results’ event occurs, then you should add the ‘title’ parameter in the text box under ‘Additional Query Parameters’:

add additional query parameters

Additional query parameters are useful when your website search functionality allows users to filter search results using multiple filters. 

Step-13: Click on ‘Save’ in the upper right corner of the overlay to save the advanced site search settings:

save

Step-14: Click on ‘Custom definitions‘ under the ‘Property‘ column in the GA4 admin area:

custom definitions ga4

Step-15: Click on the ‘Create custom dimensions’ button:

create custom dimensions ga4 2

Step-16: Enter ‘search_term’ as the dimension name:

dimension name

Step-17: Type‘search_term’ in the text box under the event parameter and then click on the ‘save’ button:

save custom dimension

You will now see the ‘search_term’ listed as a custom dimension:

You will now see the ‘search term listed as a custom dimension

When you register an event parameter (like ‘search_term’) as a custom dimension, you see a new data card added to various event reports in GA4 once the parameter is logged (recorded):

data card

I will show you later how to view this data card.

Testing site search tracking in GA4

Once you have set up site search tracking in GA4, you need to test it to make sure that it is working correctly.

Follow the steps below:

Step-1: Navigate to the website for which you set up site search tracking in GA4.

Step-2: Make sure that you have installed the ‘Google Analytics Debugger’ chrome extension in your web browser and that it is turned on:

google analytics debugger chrome

Step-3: Use the search feature of your website by entering a search term in the search box:

enter search term 1

You should now see the search result page:

search results page

Step-4: Click on the ‘DebugView’ report under the ‘Property’ column in the GA4 admin area:

DebugView report GA4

Step-5: Set your debug device to ‘Google’ as we are using Google Analytics Debugger Chrome extension:

debug device google ga4 1

Step-6: Wait for a minute or so, scroll down and then find and click on the event ‘view_search_results’:

view search results event ga4

Step-7: Scroll down and then click on the event parameter ‘search_term’:

search term event ga4

You should now be able to see the keyword you used to find information on your website (in our case, the keyword is ‘utm parameters’:

utm parameters ga4

Since you can see the ‘view_search_results’ event and its corresponding parameter, it means the site search tracking is working correctly on your website. 

There are two ways you can see the data related to site search terms in GA4:

  1. Through the ‘Events’report
  2. By creating an exploration report (recommended)

Finding site search terms data through the ‘Events’ report

Follow the steps below:

Step-1: Once you have set up site search tracking, wait for at least 24 hrs before you go to find site search terms data in your GA4 property.

Step-2: Navigate to Reports > Engagement > Events

events

Step-3: Type ‘search’ in the search box and then press the enter key:

enter search

Step-4: Click on the event name ‘view_search_results’:

click event name

You should now see the report for the event ‘view_search_results’:

view event report

Step-5: Scroll down the report until you see the data card named ‘SEARCH_TERM’:

view data card

This data card reports on the search terms in decreasing order of event count.

The data card has also got a scroll bar on the right to scroll down:

scroll bar

Finding site search terms data by creating an exploration report

Follow the steps below:

Step-1: Click on the ‘Explore’ link from the left-hand side navigation bar in your GA4 property:

Step-2: Click on the ‘Blankexploration report template:

blank

Step-3: Name your report ‘Site Search Report’:

name report

Step-4: Set the date range to the last 30 days:

set date range

Step-5: Click on the + button next to ‘DIMENSIONS‘:

add dimension button

You will now see a screen like the one below:

select dimensions

Step-6: Search for the ‘Search Term’ dimension and then click on the checkbox next to it:

search term

Step-7: Search for the ‘Event Name’ dimension and then click on the checkbox next to it:

event name

Step-8: Click on the ‘Import’ button to import all the selected dimensions to the report:

import

You should now see all the imported dimensions listed under the DIMENSIONS section:

imported dimensions

Step-9: Click on the + button next to METRICS:

add metrics

Step-10: Search and select the following metrics one by one in the exact order as mentioned below and then click on the ‘Import‘ button:

  1. event count
  2. event count per user
select events

You should now see all the imported metrics listed under the METRICS section:

imported metrics

Step-11: Double-click on the dimension ‘Search Term’ so that it is automatically added to the Rows section:

add dimensions to rows

Note: When you double-click on the ‘Search Term’ dimension, you won’t see any change to the canvas on the right. But the dimension has been added to the canvas. Only when you start adding metrics to the canvas will you start seeing the dimension(s) added to the canvas.

Step-12: Double click on the following metrics one by one, starting from the very top, so that they are automatically added to the blank canvas on the right:

  1. event count
  2. event count per user
add metrics to canvas

Step-13: Scroll all the way down under the ‘Tab Settings’ column until you see the section called ‘FILTERS’:

filters

Step-14: Click on ‘Drop or select dimension or metric’:

drop or select metric

Step-15: Click on the ‘Event Name’ dimension from the drop-down menu:

event name drop down

Step-16: Click on the ‘Select match type’ drop-down menu:

select match type

Step-17: Click on ‘exactly matches’:

exactly matches

Step-18: Click on the ‘enter expression’ text box:

enter

Step-19: Type ‘view_search’ in the text box and then click on the first search result:

view search

Step-20: Click on the ‘Apply’ button to apply your filter to the canvas on the right:

apply

You should now see a screen like the one below:

finished screen

That’s how you can see the site search terms data via the exploration report. 

#1 Google Analytics 4 Intro

  1. What is GA4 (Google Analytics 4) – The Apps + Web Property?
  2. Key Benefits of Using Google Analytics 4 (GA4)
  3. Setup GA4 – Upgrade to GA4 – Implementation Guide
  4. Google Analytics 4 (GA4) vs Universal Analytics – What is the Difference?
  5. GA4 vs GA4 360 – Pricing, Limits, Billing and More
  6. Google Analytics 4 Training & Tutorial with FREE GA4 ebook

#2 Google Analytics 4 Property

  1. Google Analytics Account Hierarchy (Structure Explained)
  2. Understanding Google Analytics Measurement ID (GA4)
  3. Google Signals GA4 – See Demographics (Gender, Age) in Google Analytics 4
  4. Using the GA4 (Google Analytics 4) Test Property
  5. Google Analytics 4 Sub Properties Tutorial
  6. Roll up Property in Google Analytics 4 (GA4) – Tutorial

#3 Google Analytics 4 Integrations

  1. How to connect GA4 (Google Analytics 4) with Google Data Studio
  2. How to link GA4 (Google Analytics 4) with Google Ads
  3. How to link Google Search Console to Google Analytics 4 (GA4)
  4. How to Install Google Analytics 4 on Shopify
  5. GA4 Firebase Integration – Correctly Add App Data Streams to GA4 Property

#4 Google Analytics 4 Events

  1. GA4 (Google Analytics 4) Event Tracking Setup Tutorial
  2. Understanding Event Parameters in Google Analytics 4 (GA4)
  3. Recommended Events in Google Analytics 4 (GA4)
  4. Enhanced Measurement Events in Google Analytics 4 (GA4)
  5. Automatically Collected Events in Google Analytics 4 (GA4)
  6. How to Set Up GA4 Custom Events via Google Tag Manager
  7. Events Report in Google Analytics 4 (GA4)
  8. How to Rename Events in Google Analytics 4 (GA4)
  9. How to Use Google Analytics 4 Event Builder
  10. GA4 Form Interactions Tracking – Enhanced Measurement

#5 Google Analytics 4 Conversions

  1. Google Analytics 4 Conversion Tracking Guide – GA4 Goals
  2. How to Import Conversions from GA4 Property to Your Google Ads account
  3. GA4 Conversion Rate – How to find it and use it

#6 Google Analytics 4 Dimensions

  1. GA4 (Google Analytics 4) Dimensions Tutorial
  2. GA4 (Google Analytics 4) Custom Dimensions Tutorial
  3. GA4 User Properties (User Scoped Custom Dimensions) – Tutorial
  4. Event Scoped Custom Dimensions in GA4 – Tutorial

#7 Google Analytics 4 Metrics

  1. GA4 (Google Analytics 4) Metrics Tutorial with Free Google Analytics 4 Ebook
  2. GA4 (Google Analytics 4) Custom Metrics Tutorial
  3. What are Predictive Metrics in Google Analytics 4 (GA4)

#8 Google Analytics 4 Ecommerce

  1. GA4 (Google Analytics 4) Ecommerce Tracking via GTM – Tutorial

#9 Google Analytics 4 Specialized Tracking

  1. GA4 (Google Analytics 4) Enhanced Measurement Tracking Tutorial
  2. Cross Domain Tracking in GA4 (Google Analytics 4) Setup Guide
  3. GA4 Site Search – Tracking Site Search in Google Analytics 4
  4. GA4 (Google Analytics 4) Scroll Tracking Tutorial
  5. Self-referral Google Analytics 4 – Referral exclusion GA4
  6. GA4 (Google Analytics 4) Data Import Tutorial
  7. Google Analytics 4 Content Grouping – Create Content Groups in GA4
  8. How to Track Single Page Apps in Google Analytics 4 (GA4)
  9. utm_source, utm_medium, utm_campaign Parameters – GA4 (Google Analytics 4)
  10. GA4 Form Tracking via Google Tag Manager

#10 Google Analytics 4 filters

  1. GA4 filters – Understanding Data Filters in Google Analytics 4
  2. How to Create and Test Filters in Google Analytics 4 (GA4)?
  3. Exclude Internal Traffic in GA4 (Google Analytics 4) via IP Filter

#11 Google Analytics 4 Explorations

  1. Free Form Report in GA4 (Google Analytics 4) – Exploration Report
  2. How to Use the User Lifetime Report in Google Analytics 4 (GA4)
  3. How to Use Path Exploration Report in GA4 (Google Analytics 4) – Path Analysis
  4. How to Use Segment Overlap Report in Google Analytics 4 (GA4)
  5. How to Use the Funnel Exploration Report in GA4 (Google Analytics 4) – Funnel Analysis
  6. Cohort Exploration Report in Google Analytics 4 (GA4)
  7. How to Create Landing Pages Report in GA4 (Google Analytics 4)
  8. How to Create Google Ads report in GA4 (Google Analytics 4)
  9. How to Segment GA4 Data by Data Stream
  10. Organic Search Traffic Analysis in GA4 – Complete Guide
  11. Google Analytics 4 (GA4) Outbound Links Tracking
  12. How to Track Email Campaigns and Traffic in GA4 
  13. How to view full page URLs in GA4?

#12 Google Analytics 4 Advanced

  1. Understanding Google Analytics 4 Sessions
  2. GA4 (Google Analytics 4) Measurement Protocol Tutorial
  3. How to Build Comparisons (Advanced Segments) in Google Analytics 4 (GA4)
  4. Understanding Automated Insights in Google Analytics 4 (GA4)
  5. Understanding Channel Groupings in Google Analytics 4 (GA4)
  6. Understanding Data Sampling in Google Analytics 4 (GA4)
  7. Google Analytics 4 Regex (Regular Expressions) Tutorial
  8. Google analytics 4 GDPR compliance checklist

#13 Google Analytics 4 Reports

  1. How to Create Custom Insights in Google Analytics 4 (GA4)
  2. How to Use Debug View Report in Google Analytics 4 (GA4)

#14 Google Analytics 4 Attribution

  1. Guide to Attribution Models in GA4 (Google Analytics 4)
  2. How to Change Attribution Models in GA4 (Google Analytics 4)?
  3. GA4 (Google Analytics 4) Conversion Paths Report in Attribution
  4. GA4 (Google Analytics 4) Model Comparison Report in Attribution
  5. Advertising Snapshot in GA4 (Google Analytics 4) Attribution
  6. GA4 Attribution Modelling Tutorial

#15 Google Analytics 4 Audiences

  1. GA4 Audiences – Creating Custom Audience in Google Analytics 4
  2. How to Create a Remarketing Audience in Google Analytics 4 (GA4)
  3. Understanding Audience Triggers in Google Analytics 4 (GA4)
  4. Google Analytics 4 (GA4) Predictive Audiences – Tutorial

#16 Google Analytics 4 BigQuery

  1. GA4 BigQuery – Connect Google Analytics 4 with BigQuery
  2. BigQuery GA4 Schema – Send Custom GA4 Data to BigQuery
  3. How to Backfill GA4 Data in BigQuery
  4. How to Connect and Export Data from GA4 to BigQuery

Frequently Asked Questions About GA4 Site Search Tracking

What is site search functionality in Google Analytics 4?

Site search is a functionality provided by a website in the form of a search box through which website visitors search the website for information or products. If your website provides site search functionality, you should set up ‘site search tracking’ in Google Analytics 4.

Through the GA4 site search feature, you can determine the search terms used by your website visitors to find information on your website.

How do I identify search query parameters?

By default, the search event is triggered based on the presence of one of the following five parameters in the URL:
1. q
2. s
3. search
4. query
5. keyword
If your website uses any parameter other than a default parameter in its URL, you can also configure a custom parameter to fire the event.

How to set up custom search query parameters?

To set up custom search query parameters, follow the below steps
Step-1: Navigate to Admin Settings of your GA4 property
Step-2: Click on Data Stream and select the data stream for which you want to set up a custom search query parameter
Step-3: An overlay will appear, like below, showing data stream details. It also shows details of enhanced measurement, which automatically tracks page views, scrolls, outbound clicks, file download, and site search. Click on the ‘Gear’ icon.
Step-4: Click on ‘Show advanced settings’ under the ‘Site search’ option in ‘Enhanced Measurement’.
Step-5: In the ‘Additional Query Parameters’ text box, type your custom query parameter that reflects in the URL when someone searches.
Step-6: Click on ‘Save’.

Register for the FREE TRAINING...

"How to use Digital Analytics to generate floods of new Sales and Customers without spending years figuring everything out on your own."



Here’s what we’re going to cover in this training…

#1 Why digital analytics is the key to online business success.

​#2 The number 1 reason why most marketers are not able to scale their advertising and maximize sales.

#3 Why Google and Facebook ads don’t work for most businesses & how to make them work.

#4 ​Why you won’t get any competitive advantage in the marketplace just by knowing Google Analytics.

#5 The number 1 reason why conversion optimization is not working for your business.

#6 How to advertise on any marketing platform for FREE with an unlimited budget.

​#7 How to learn and master digital analytics and conversion optimization in record time.



   

My best selling books on Digital Analytics and Conversion Optimization

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and BeyondSECOND EDITION OUT NOW!
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.

About the Author

Himanshu Sharma

  • Founder, OptimizeSmart.com
  • Over 15 years of experience in digital analytics and marketing
  • Author of four best-selling books on digital analytics and conversion optimization
  • Nominated for Digital Analytics Association Awards for Excellence
  • Runs one of the most popular blogs in the world on digital analytics
  • Consultant to countless small and big businesses over the decade

Learn and Master Google Analytics 4 (GA4) - 126 pages ebook

X
error: Alert: Content is protected !!