In this article we’ll track the search queries which are giving no results. Tracking no search results are very important as you might be missing out on potential customers who are searching for something and not getting any results.

If you are using Expertrec Search you don’t need to do any setup and you can skip setup section and jump on Chicking NoResults trends in Google analytics.

Let’s get started on how to track zero result queries in google analytics:

You would need to figure out how zero results look according to your website.

Here is a sample of no search result

track zero result queries in google analytics

For the above case:

You can run a little javascript to find the element which contains the above no search result text and if the element exists send an event to google analytics.

Note: The code totally depends on your website. The below code may not work at all

I’ll break down the steps that are required to get your own code running for tracking zero result queries in google analytics

  • Find out your no search result page type
  • If it is a page, write a function to use javascript location variable to figure out that it’s no search results page
  • If an element, write a function to use css selector to check if the element exists using javascript.
  • Write a function to get the query from input box or url path/query parameters
  • Once you have you functions ready call the function to check if you are on a no search result page.
  • If you are, get the search query and run the below script

ga(‘send’, ‘event’, ‘Search’, ‘ZeroResults’, ‘SearchQuery’);

The parameters passed are:

  • ‘Search’ – sending a search event to Google Analytics
  • ‘ZeroResults’ – Naming the category under which zero results should be tracked
  • ‘SearchQuery’ – Search query for which there were zero results

Note: The above code may vary based on your integration of Google Analytics

There’s a simpler way of tracking zero result queries in google analytics. You don’t need to follow all the above steps and break your head over it. expertRec search will easily integrate zero search results on your website with google analytics.


code to easily track zero search results using google analytics

Click here Sign up for expertRec custom site search

If you have integrated google analytics as per latest recommendations by Google, you are already tracking search queries as well as zero result queries in google analytics with expertRec.

If you have added it in a different way or as per old recommendation you can go to the prerender page in the dashboard and update your GA tracking snippet for no search results there.

 Chicking NoResults trends in Google analytics

Once this setup is done, you can check ZeroResult query In Google Analytics under Behaviour -> Events -> Top Events. Select event category: Search and event action: ZeroResults.

ZeroResult Google Analytics