Adaptive Mind

Zero Results Search Terms in Google Analytics (async edition)

Posted by: Lukáš Zaplatílek on: 14. Červen 2011

Introduction

Why should we bother? Because it is actionable!

Internal search is the best place to gather feedback from your potential customers. They come to your website and tell you:

  • what they want to find there;
  • where did they gave up trying to navigate there and used search functionality instead.

But what do they do if they see an empty results page? Some might try to refine their search phrase, but I would say that it really doesn’t improve their overall experience.

It also might be the good signal for you to:

  • deliver content that is not currently present on your website;
  • change copywriting a bit in case you have picked a different words for the content;
  • or try to implement a manually added results for those searches.

Prerequisites

This article is meant to describe possible solutions when you are using a newer asynchronous Google Analytics tracking code placed in the head section of your website.

Google Analytics doesn’t provide this report by default. So we will have to do some extra work to achieve this. The first thing that is necessary to do is to be sure that you are able to identify a zero search results page programmatically.

Then you need to be able to manipulate the Google Analytics Tracking Script a bit or include an extra block of JavaScript into the tracked page.

Options to consider

You certainly don’t want to use an extra _trackPageview call, because this would inflate your data (especially Pages per Visit metric).

In certain cases you actually might be able to modify the tracked URL, but it can be achieved only in particular Web Content Management Systems that are able to pass in all the variables from the page into any template fragment of the generated page. With this capability, you could manipulate the tracked URL as described in this article by Justin Cutroni. The resulting code might look a bit like this:

<script type="text/javascript">
       var _gaq = _gaq || [],
             p = document.location.pathname,
             s = document.location.search;

       _gaq.push(['_setAccount', 'UA-15436952-1']);
<? if (resultsCount == 0) { ?>
       _gaq.push(['_trackPageview', p + s + '&category=no-results']);
<? } else {?>
       _gaq.push(['_trackPageview']);
<? } ?>
       (function() {
             ...you know this part...
       })();
</script>

Afterwards you can proceed with the Site Search functionality configuration by the instructions from Justin’s article.

If you don’t have such a comfortable CMS, you can still measure some extra data with the two following features of Google analytics.

Event Tracking

This method was already described in the article Using Google Analytics to Track ‘Zero Results Found’ for Site Searches by Bob Scavilla. I would just point out that it might be a lot easier if the actual search term would be generated by the CMS so you won’t have to suck it from the URL with a regular expression. The resulting code looks much simpler thought:

<? if (resultsCount == 0) { ?>
<script type="text/javascript">
       _gaq.push([
              '_trackEvent',
              'Search',
              'No-results',
              '<?=$searchTerm?>'
       ]);
</script>
<? } ?>

Custom Variables

The first thing you can do is to use a page-level custom variable. You can store the actual zero results search terms like this:

<? if (resultsCount == 0) { ?>
<script type="text/javascript">
       _gaq.push([
       		'_setCustomVar',
		1,
		'No-results',
		'<?=$searchTerm?>',
		3
	]);
</script>
<? } ?>

or you can store the particular results count:

<script type="text/javascript">
       _gaq.push([
       		'_setCustomVar',
		1,
		'Results-count',
		'<?=$resultsCount?>',
		3
	]);
</script>

Then if you are a little advanced, you can use the API to show all search terms and their count of results in one report (using ga:searchKeyword and ga:customVarValue1 dimensions and ga:pageviews metric).

Conclusion

The only downturn of some of these methods is that the Site Search Terms report still includes all the searches that ended up with no results and you cannot really distinguish them.

Vlastnosti: ,

Napsat komentář

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Změnit )

Twitter picture

You are commenting using your Twitter account. Log Out / Změnit )

Facebook photo

You are commenting using your Facebook account. Log Out / Změnit )

Connecting to %s

Sleduj mě na Twitteru

Moje twíty

  • Úděl chudáka Pražáka v Brně je bloudění mezi hernami. Příště mi pošlete alespoň pár tipů kam vyrazit #krno 2 days ago
  • Jako vážně! #dnes #brno #pivo #UX #WA #hashtaghell 2 days ago
  • Někdo večer v Brně na jedno? #krno 2 days ago
  • Kdy myslíte, že se objeví první kopie nápadu Fullpage-Background-Breadcrumbs z nového Basecampu na českých webech? 6 days ago
  • Otázka není "jak uchránit (čti zpeněžit) 'duševní vlastnictví'", ale jestli vůbec něco takového existuje a jaký smysl to má mít. 2 weeks ago

RSS 417.cz

Follow

Get every new post delivered to your Inbox.