Posted by: Lukáš Zaplatílek on: 14. Červen 2011
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:
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:
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.
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.
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>
<? } ?>
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).
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.
Nejnovější komentáře