Ultimate Guide to Site Search Tracking in Google Analytics

An often overlooked part of Google analytics setup is configuring the on site search. This feature can give you a lot of insight into your users behavior and help you and improve your website.  In this article we will cover the setup and common configuration issues of on-site search for Google analytics and Google tag manager.  

Why is Site Search important?

Let me highlight the benefits::

  • Site Search will give you insights into how users interact with your page
  • It will help you understand the queries users input
  • It will help you optimize your user journey for intent
  • Site search users are incredibly valuable because of:
    • Higher Conversion Rate
    • Lower Bounce Rate
    • Higher Session Duration

Before we begin

Before starting this tutorial please make sure that:

1. You have GTM placed on your website
2. You have admin access to Google Analytics
3. You did a search on your website and there is a query parameter in the URL for example “example.com/?q=” (write down the URL for late use)

If you got 3x YES, lets begin!

Configuring Site Search

The process to configure site search is really simple

1. Enter analytics.google.com

2. Enter into View Setting 

3. Go to Site Search Settings, set Site Search Tracking to ON.

4. Add a parameter from your search results. The most often parameter is q or s

5. Save changes and you are ready.

Striping Query Parameters from URL

The recommended option is to set this to yes. In practice this means that Google Analytics will exclude or strip the search parameter from load sent to GA. You can notice the difference on the screenshot below. Not stripting the query parameter causes the creation of a lot of additional sites in the Site Content Report.

Site Search Category Setting in Google Analytics

Enabling this setting can bring you a lot of value. First of all you can find out how users interact with the search results. You can notice if they entered into one category and then changed the scope. This can help you with displaying the most relevant results. 

In the image below you can see how the category can be noticed in search results.

Why is Tracking Empty Search Results with Site Search Important?

There are a number of different queries that users input and get into a deadend. For example using alternative popular names of products or synonyms. For example from Bucherer.com when entered “hulk” which is an alternative name for the ROLEX SUBMARINER 116610LV. 

When performing this search on Google we get a lot of results, but then when doing a search on the watch’s reseller website we can notice no results appear. For every e-commerce manager this could be additional information to map those keywords to products. Of course, in our case it is completely possible that the brand does not want to appear on this keyword but the example stands.

What areEmpty Search Results and why tracking them is important?

Empty search results also known as zero-results or null results, are an important part of the whole setup. This kind of result is a deadend, that often makes the user leave the website and never come back. This is the first point, we have to make sure this does not happen. Secondly, we should ask ourselves, what we should show the user when we don’t carry the items he’s seeking? We can use this to show him for example related articles

If you identify the search terms that bring your users to a deadend, you can optimize for this and propose them a different path. For example by showing products in promotion, related products, bestsellers and so on.

How to Track Empty Search Results with Google Analytics

To track empty search results, we need to set up an event with Google Tag Manager that will notify us if a user performs an empty search. This section is based upon this post and covers WordPress setup but you can apply it to any website with the same principles.

Empty search results tracking with Google Analytics tutorial

  1. Enter a query that has no results

1. Copy the CSS path that will inform us if there are any results. Right click the ‘Nothing found’ text and go to ‘inspect’. Ensuite select the element’s CSS path.

2. Open the Google Tag Manager panel -> Variables -> at the bottom click ‘New’ -> DOM element. Use the CSS selector method and paste the CSS path you just copied. Please remember about the proper naming of the variable ‘DOM – searchResults’

3. Save and close. Add another Variable and use Lookup Table with a name ‘LT – searchResults’. As the input variable selects our DOM – searchResults and in the input put ‘Nothing found’, the output should be set to ‘no results’. Please also remember to set the default value to ‘with results’. The aim of this is to check if our variable ‘DOM – searchResults’ displays a ‘nothing found’ text. If the text does not exist it means we got search results.

4. Add the third variable that will be used to find the query the user has input. Click “New” variable and use URL->query Component Type. Please input your search variable in our case it equals ‘s’.

5. Next we need to trigger the whole setup. Go to Triggers-> New. Select ‘Page view’ and add a condition Page URL contains “/?s=”

6. Putting it all together. Add a new Tag -> Universal Analytics -> Type ‘Event’
  1. Category = Search
  2. Action = {{LT – searchResults}}
  3. Label = {{URL – searchQuery}}

7. You are all done. Now test this in the GTM preview mode and if you followed correctly you will have 3 variables active and a Google Analytics search event triggered.

Analyzing Search Results with Product List Performance Report

This option is only available for platforms with Enhanced Ecommerce set up. The product List Performance Report Lets you check what product appeared on the search results page, what was their position, Impressions, Click, CTR. It gives you a lot of data to analyze and optimize. You can test this using the Google Merchandise Store:

The Product List Report can be accessed in Analytics by going to Conversions -> E-commerce -> Product List Performance -> Search Results (or the name of your product list)

To be completely honest I recommend modifying the list name to reflect a specific query this means “Search Results – {{Search Query}}”. With this setup you will be able to see what specific product appears on the search results page and in what order. This can also help you optimize their performance by changing product positions, eliminating irrelevant products, adding missing products. There are a slew of optimizations available. Here is the example of Product List Position

Product List Performance Use Case Example

Let’s assume we are the e-commerce managers for Google’s Merchandise Store and we have a lot of stock for our Google Color Block Notebook. We need to sell this as there is a new edition coming.

When analyzing our search results we noticed that when a user types “notebook” the Google Color Block Notebook is on the 13th position. We would like to make this notebook appear in the first row to give it more consideration. We ask our dev to manually change the order of the results for all notebook related queries so our Notebook Appears First. This way we can help our stock levels. Here you can see the results for each position of the Google Merchandise Store, and you can notice that position number one has the highest Click Through Rate.

Google Analytics Site Search Metrics Explained

Now we are going to explain all the most important metrics.

  1. Search Term – The search term used by the user and entered into the search field
  2. Total Unique Searches – The number of times people searched your site. Duplicate searches within a single visit are excluded.
  3. Results Pageviews / Search – Results Pageviews/Search is the average number of times visitors viewed a search results page after performing a search.
  4. % Search Exits  – How many exits from your site occurred following a result from an internal search.
    1. ???? How to use this : When you find a search term with a Unique Search volume but High % of Exits you can optimize this result to include more relevant products.
  5. % Search Refinements – The percentage of times a user enters an initial keyword but then changes it within the same session. For example if a user searches for a ‘shirt’, and then for a ‘blue shirt’ this is a search refinement. It is neither a good or bad metric but should be monitored and properly interpreted. If we see a lot of broad terms that are refined we might consider adding some suggestions in the search box that help the users with the initial search.
  6. Time after Search – The time a visitor spends on your site after getting to the search results page.
  7. Avg. Search Depth – The number of pages visitors viewed after getting results for the search term.
  8. Start Page – The page where the user enters the search query.
    1. ????How to use this : Please use this report to find pages with the highest number of searches performed. This will help you optimize your website for user intent.
  9. Destination Page – The page where the user lands after typing the search query. If you exclude the search parameter it is quite possible 
  10. Search Destination Page – Where the user goes after performing the query. 

Google Analytics Site Search Without Query Parameter

If you are using a non-standard or custom CMS it is possible that you don’t have the query parameter in the URL. In this case, it takes a few more steps to configure Google Analytics Site Search. The easiest way is to ask your developer to include the search term in a query parameter. If this is not possible please follow these instructions

Search included in the URL without query

In this case, you should add a filter to your Google Analytics View. The filter will extract the search term from the URL and add it as a search term.

This needs to be adapted to your specific setup but here is the step-by-step.

  1. Open Google Analytics Admin, go to View Settings and open filters.
  2. Add a filter with these parameters:
    1. Filter Name: Search Terms
    2. Filter Type: Custom->Advanced
    3. Field A -> Extract A: Request URI : (?<=search\/)(.*)
    4. Output To -> Constructor: Search Term : $A1

Getting insights from site search

Thanks to the setup above we have the data we need to get insights and improve our website. Now I will go through several cases to use this data.

Remember, analyzing data starts with a question.

However, in analytics this question often opens up many more, for which we strive to find answers. The second thing you must focus on is that you should not report raw data, present data with context, draw insights and give recommendations.

Why should we care that users search for “gloves” ? We should care with additional context. The searches for gloves are 50% of all searches , the winter season is coming, our glove stock is running low and the conversion rate is very low.

  1. Empty search results tracking
    • refine your product range – If you see people search for a particular item, but you don’t carry it. It might be a good idea to include it.
    • map users search terms – we all use colloquial language and not always the things we search are the things we want. With the list of empty search terms you can map new keywords to products you have in stock.
    • refine your messaging – you might be misleading your users with the messaging on your website. Users think you sell something, you actually don’t. After analyzing the search results you can identify these points
  2. Search Results
    • Search usage – Users with site search usage have higher conversion rate. Is this true for your website? If not maybe there is something incorrect with your search.
    • Search usage – I have seen this value range from 0.02% to 30% for e-commerce stores. See what’s the value for you. If the conversion rate for users who use search is high, can you increase the percentage of users who use site search?
    • Search Usage Trends – You did not do any changes on the website but the % users who use search increases. What is the reason for this? Is there a particular search that is increasing in volume?
    • Search Usage by Device type/system/model – Is there any particular device that has more searches than other? We should investigate
    • Search terms report – see what are the users searching for and optimize your website for it. Do you have all the items? Do you need more stock of a particular product? Is the search volume for it increasing?
    • Start page – We need to know where users start their journey. Is there any particular page that stands out? Check it out and look out for issues
    • Start page->search term – we saw where users start the journey, what are they looking for? If they are looking for something specific, maybe we can add this to the page.
    • Product list performance – What products appear on a particular search query? Are they correct?
    • Product list performance / device – is the performance by device different? Maybe there are any website issues that influence conversions.

I hope that this initial list will help you understand your users more and ask the correct questions.

Google Analytics site search not working –
common issues and solutions

Google Analytics not showing search queries

The problem is probably you don’t have site search enabled. To enable site search follow the instructions on in the Configuring Site Search Section

Google Analytics not showing search queries, but site search is configured.

It is possible you configured search incorrectly. In the query field of the configuration you only need to input the query word without any additional points. It should say ‘s’, not ‘?s=’.

Any additional questions?

Leave a comment if you have other problems I will try to figure it out 🙂

Leave a Comment

Your email address will not be published. Required fields are marked *