Leverage zero result searches for improving site content

Google+Tweet about this on TwitterShare on FacebookShare on LinkedIn

Although some excellent guides on how to track zero result searches in Google Analytics have already been published in those blogs dedicated to digital analytics (including Justin Cutroni’s post here), I decided to offer a solution that:

  1. proposes the usage of Google Tag Manager
  2. allows you to track further actions of those users who received zero search results

Thus, not only would we be able to identify missing content on the site (or even a problem with the search engine), but it would also allow us to improve the nothing-found page to prevent users from abandoning the site after receiving zero search results.

track zero result searches in Google Analytics results

The post is divided into the following chapters.

  1. Before we begin
  2. Identify zero result search page
  3. Configure a set-up to track zero result searches
  4. Track further actions
  5. Summary

Before we begin

Before we delve into details on how to track zero result searches in Google Analytics via Google Tag Manager, let me remind you that there are existing services/tools that can provide you with this kind of data. For instance, Search Meter for WordPress. So, in case you have one of these tools installed on your website and you are totally satisfied with it, probably, there’s nothing much for you to learn here.

I would also recommend reading the following articles that provide an in-depth exploration of site search data in Google Analytics.

  1. Five questions to ask of your site search data by Avinash Kaushik
  2. Site search in Google Analytics by Samantha Barnes (Lunametrics)

Now, without more ado, let’s see how we can use Tag Manager to track zero result searches in Google Analytics.

Identify zero result search page

First, we need to identify a search page with zero results. This can we be easily done by finding a unique attribute that is only specific to this particular page. Let’s take the zero result search page for my blog as an example.

track zero result searches in Google Analytics page-min

As the screenshot implies, when a certain search query generates zero results, my <H1> HTML tag has the value of “NOTHING FOUND”. I see no reasons why I can’t use that as a unique identifier.

To do that, let us first create a custom JS variable like this.

And name it like zeroResultSearch. Here’s an explanation. If there is a <H1> tag on the page with the value of nothing found and the location search property start with “s=”, this function will return a truthy value. Otherwise, it will return false. Thus, we can be quite sure that the page is of ‘zero-result-search’ type.

Next, let’s identify the search query that has generated zero results. To do that, we simple need to create a URL variable with Query as a component type and our search term as query key. Let’s name it like siteSearchQuery.

track zero result searches in Google Analytics query-url-min

Please do mind that you will need to use your own search term. For instance, “q”.

Configure a set-up to track zero result searches in Google Analytics

Finally, we need to send an event to GA once a certain query generates zero search results. Create a trigger like this:

track zero result searches in Google Analytics trigger-1-min

And an event tag like this:

track zero result searches in Google Analytics tag 1-min

Thereby, you will have an event sent to GA each time when a certain search query does not produce any results. Not only that, you will also define the exact word/phrase that triggered the event.

Thus, you can acquire useful data that may help you improve the content of your website.

Track further actions

Now, when we are done with a set-up that allows us to track zero result searches in Google Analytics, let’s see how we can get the information concerning the behavior of those users who received no results.

Refinements

Naturally, we would want to know if users refine their search. To perform this, we will simply track search form submissions on the zero-result page. Again, let us take my blog as an example.

Here is a trigger.

track zero result searches in Google Analytics 2 min

As you can see, I use previously created custom JS variable for the Enable When condition to make sure the trigger fires only on the page with zero search results and Form Element matches CSS selector form[role=”search”].search-form for the Fire On condition since that’s the easiest way to track search form submissions here.

Next, you should create a UA event tag and attach the above trigger to it. Thus, once users refine their search, you will have an event sent to GA.

track zero result searches in Google Analytics tag-2-min

Suggestion clicks

We can also track link clicks located in the suggestion block. Thus, we acquire data on how this block performs. Here’ a trigger for my nothing-found page.

track zero result searches in Google Analytics trigger-3-min

And here is the tag.

track zero result searches in Google Analytics tag-3-min

By adding Click URL as the event’s label we can see which suggestion works best for certain zero-result search queries.

Summary

The solutions listed here are DOM-dependent. This means that you will have to adjust them according to your site’s source code.

I hope this little tip will come in handy both for those who want to fix the Exit Search metric and those lacking data-based solutions for improving their website’s content.

Google+Tweet about this on TwitterShare on FacebookShare on LinkedIn