I <3 Google Analytics Site Search reports. There’s amazingly actionable data in those reports. But they’re missing one vital piece of information: searches that don’t produce any results.
Why is this important? Don’t you want to know when visitors search and don’t get any results? Zero result searches can help your identify missing content on your site or a problem with your site search engine.
Many search solutions will provide this information for you. For example, I use Search Meter for WordPress and it shows me which search queries generate zero results. But I thought it would be interesting to add this data to Google Analytics. That way all my site search information would be in one place.
Unfortunately there is no easy way to add this data to GA. You need to do some programming to collect the data. So this post is really meant for those folks with programming resources AND for those developers that maintain GA plugins. Like my buddy Joost, who has a great GA plugin for WordPress.
If you’re interested in the data and analysis, skip to the bottom of this post.
Conceptual Overview
Our goal with this hack is to modify site search data in two ways. First, we’re going to put all search queries with zero results in a category. This will allow us to use the Search Categories report to easily find all the search terms that yielded zero results.
Second, we’ll modify the actual search terms to indicate that a term yielded zero results. This will make it easy to scan a list of all the search terms and identify which generated no results.
Before we get into the implementation, a big THANK YOU to Charles Miller, one of the lead consultants here. He wrote the JavaScript below. Thanks Charles.
Step 1: Identify No Result Search
The first step is to identify a zero results search page. Most websites have the same search results page regardless of the number of results. You need to identify some something that differentiates a zero results search page from a non-zero results search page.
This must be done programatically and is the hardest part of the implementation.
For example, a zero results search page on this blog has the text “No posts found. Try a different search?”
I can create code (or more specifically, Charles can create code) to look for the text “No posts found. Try a different search?” If the code finds this text in the page then I can identify that the visitor’s search yielded zero results and than I can send the data sent to GA. Here’s the code that I’m using on this blog:
var content = document.getElementById('content');
if (content.innerHTML.search('No posts found.')) {
The code looks for a section of the page called ‘content’ and then searches that section for the phrase ‘No posts found.’. If ‘no posts found.’ is found (oh, the irony!) then we will modify the data sent to GA.
Important! The way you detect a zero result search page may be different. It’s VERY difficult to create an example that will work for everyone. Take this as a conceptual overview.
Step 2: Tweak GA Tracking Code
Once we know what differentiates a zero results search page we can add some code that tweaks the data. Remember, we want to modify the data in two ways: 1. by placing it in a special search category and 2. by modifying the search term to indicate it did not yield any results.
To create the category all we need to do is add an extra query string parameter to the URL.
To manipulate the search term we need to split apart the page URL and then put it back together with the phrase no-results.
Here’s the complete code.
The code starts with the section that identifies a zero result search page.
Then we deconstruct the URL to identify the search term. Finally we add the category named ‘no_results’ and the phrase ‘no-results’ to the search term.
If the code does NOT find the term ‘No posts found.’ then a pageview is created as normal.
That’s it for the coding part (thank goodness!)
Step 3: Configure Site Search Settings
The last step is to add the new category parameter to the Site Search settings so GA can identify the no-results search category. This is easy, it’s in the profile setting section of Google Analytics.
I also like to set the ‘Strip Query Parameter’ to YES. This removes the category parameter after site search is done processing and normalizes your pageview data.
That’s it for the configuration! We’re cleared for insight-hunting!
Analyzing The Data
When a visitor performs a search that yields zero results the search term will be placed in a category named ‘no_results’. To find this data navigate to the Content>Site Search>Categories Report:
Immediately you’ll be able to see what percentage of your searches yield zero results. Hopefully it’s very low! Want to see if this impacts conversions or revenue? Click the Goals or Ecommerce tab to check the conversion rate:
This is a bad picture, but you get the point.
Next you can click on the no-results line in the data and see exactly which search terms yielded zero results.
This is super-actionable data. Now you know where you may be missing content or if your site search engine might be broken. You should be asking yourself, “Why are there no results for these terms? Is there missing content or is there a problem with my site search engine?”
You’ll also notice that the search terms now have ‘no-results’ in them. This provides a lot of flexibility for view the search data other ways. Example, let’s use the Search Terms report:
Here we can see the search terms ranked by searches. What percent of your top 10, 20 or 50 are no-result searches? How is that impacting your bottom line?
This is just the start. You can use other metrics, like %Search Exists to understand if visitors who receive zero results refine their search or exit.
While this is not the easiest thing to configure, I hope you see the value of the data. More so, I hope that all those folks that maintain plugins add this type of feature to their GA plugins. Joost, you listening!?
My advice. I think that for a similar purpose:
When you set the zero search results page special title, eg: Not found – “search phrase” – Yourweb.com, the results report will be in Google Analytics: Content -> Content by Title.
It is necessary to filter pages containing “Missing -“.
Michal,
Absolutely! Another great way to identify zero result searches. As long as your site has a unique title for those searches. Great suggestion, thanks!
Justin
Hey Justin, another great post!
The michal’s suggest is something that I worked on some sites. That was kind of easy using Joomla (great CMS indeed!) to provide a unique title for each search.
About your suggest, it’s great AND provide a faster visualization of the user intention. I love Google Analytics (so you do I think) and for sure the most popular “hacks” from great analysts eventually can be implemented on the tool. So I apreciate your action and I wanna send a big Thank You for Charles Miller too.
Best,
@diogenespassos
Peter & Diogenes,
Thanks to both of you. It really important to me to explain the what, why and how. I know this post came out a bit ‘techie’ (according to my good friend Daniel) but I hope it inspires some developers to add it to plugins, etc.
Thanks again.
Justin
Justin,
Great article! I admire your perseverance to get past the technical stuff and get such useful analytical result.
Well done
Pete
Thanks for this, Justin! I love all the info in the comments as well. I am about to start a keyword analysis project with one of our programmers using Google Analytics – this will help! :D
Hi Justin,
Well done for an illuminating post. I have been looking at producing a failed search report for a while.
I think ‘failed search’ reports are one of two *gateway* reports. Gateway in they get people not particularly convinced by analytics that it can produce improvements in revenue quickly.
The second report that I think has this evangelical potential is to Look-to-Book ratios. I have been able to get page views by product code, but I have not been able yet to get Added to Basket by Product Code (in GA, at least).
Any ideas?
Thanks
Dan
Justin,
Another great tip, thank you just need time to work with developers implement it…
This is very powerful for understanding what people are expecting to find on a shopping site but dont…
The only potential problem I would see would be around the unique title and how quickly you could get flooded with data? I just checked one client and they had close to 15,000 search terms, and i’m scared to think how many would have resulted in “0” results.
@Dan: I love it! Gateway reports, what a great saying! Can I use it in a presentation? As for the report you are looking for, trying using the Required Step feature in the Funnel configuration. It won’t give you look to book for every product code, but the general product page. Check out this post for more information.
@David: Thanks for the feedback! GA has a table size of 50,000 unique search terms per day. So, in theory, yes, you could hit some limits. If you’re concerned with the data you could collect it on a secondary profile. And I will say that analyzing site search data, in general, is a lot of work due to all the variations. It just takes some time to wade through it all. And, if you do gain some insights from searches with 0 results, perhaps you could change the site and reduce the number of 0 result searches! :)
Hi Justin,
I just set up my own blog and this kind of settings are very useful!
Great, great post here Justin. Great hack, Charles!
Being able to quantify and qualify what is being missed out is so important – if we don’t know what we don’t know, we won’t ever fix it.
I am encountering technical problems with the goal funnel visualization in GA. I set up all the goals based on virtual page view URLs in GA a month a go. Since then we are able to see the total CVR for each metric we have set up to track however the goal funnel visualization is not matching up to the totals and in some cases contains no data at all. I realise its very hard to assess without seeing the problem. Please could you send me an area where I can upload some screen grabs or alternatively I can send a temporary login to the account to see for yourself. I would appreciate any help from anyone who is experienced with Goal reporting in GA. Thanks Vicki
Vicki,
If you’re getting pageviews for the virtual pageviews then I bet your problem is with the Required Step setting in the funnel. This setting will force GA to only track data in the funnel report IF the visitor hits the first page in the funnel setup. My guess is that the virtual pageview for the first step of the funnel may be wrong and specified as a required step.
Hope that helps,
Justin
I thing that Required Step setting in the funnel excludes visits only from funnel visualization. Conversion will be counted even if a first step is required and custommer doesn’t visit first step page.
Great post, thanks!
Hi Justin, can you please provide version of this code for asynchronous version of GA? By the way, bought your book ‘Google Analytics’. Very, very good. Use it all the time as an reference book. Unfortunately this bit is missing there as well.