Statistics tracking in EPiServer Find

This blog post provides brief overview of statistics available in EPiServer Find and describes how the statistics tracking can be enabled on a website.

Statistics and optimization

Knowledge is power. With EPiServer Find you can track and analyze search activities on your website in order to optimize search results and website content. Statistics views provide the following information:

Most frequent searches

Most frequent searches

Most frequent searches shows what people are searching on your website the most.

Searches without hits

Searches without hits

This is the list of most popular searches that did not result in any hit. Most probably, you want this section to be empty.

Searches without relevant hits

Searches without relevant hits

This is new feature. Here you can see more behavioral information: search phrases that had some hits, but these results were not clicked by users, which probably means that these hits were not so relevant for visitors.


All statistics views display up to 100 top search phrases.

Using statistics you can start optimizing search experience. Depending on specific case, you can combine the following techniques:

  • Create best bets to promote certain content and make sure that it is on top of results
  • Suggest phrases that can be related to current user search, kind of did-you-mean hints
  • Define synonyms for related phrases in order to provide more relevant hits
  • Optimize your content and structure to make sure that you have what they need and it’s easy to find
  • Blame users who searches for ‘ kammy koopa’ and ‘boom boom’ on your corporate website. No, you cannot do anything with these guys. At least using Find. So far.

Please see user guide for more information about statistics and optimization in new EPiServer Find.

Enabling statistics tracking

Just add Track() method in a query chain:

var hits = searchClient.UnifiedSearchFor("unicorn")
        .Track() // track them all!

Rendering search hits

When tracking is enabled, search hit URLs contain additional parameters like search query, site and language, client IP address and hit position.

Search hit URL with additional parameters

Output hit URLs as is when rendering search results:

<a href="@hit.Url">@Html.Raw(@hit.Title)</a>

When user clicks on search result, parameters are extracted from hit URL, stored in a cookie and browser navigates to the clean hit URL. It works also for search hits of external content indexed by crawler, while user just (left-)clicks or taps external hit link on a search page.

Information about the click is reported to the backend as soon as CMS page is loaded next time. For CMS content, the “next time” is immediately when clicked page is opened.

Statistics is also collected when the link to CMS content is opened in a new tab by Ctrl+click or using right-click menu or when the hit URL is being copied (sent to other user, maybe) and opened in a new browser window, except of links to external resources.

To make it happen, Find injects JavaScript resources on pages. Your templates should meet the standard requirements for EPiServer CMS page templates:

  • Client resource registers must be executed before rendering the page. The easiest way is to inherit one of the base page classes.
  • Page templates must render required client resources for the Header and Footer default areas. Use RequiredClientResources control for Web Forms or RequiredClientResources MVC helper:

Rendering required client resources in the page header/footer in Web Forms:

<head runat="server">
    <EPiServer:RequiredClientResources RenderingArea="Header" 
        ID="RequiredResourcesHeader" runat="server" />
<body runat="server" id="Body">
    <EPiServer:RequiredClientResources RenderingArea="Footer" 
        ID="RequiredResourcesFooter" runat="server" />

Rendering required client resources in the page header/footer in MVC:

<head runat="server">
    <%= Html.RequiredClientResources(RenderingTags.Header) %>
    <%= Html.RequiredClientResources(RenderingTags.Footer)%>

When tracking is not needed

Sometimes you may not want to track search statistics or you need monitor search activity conditionally. Maybe you don’t want to track statistics when executing searches in order to list content by certain criteria, like listing of latest news or specific products.

Just don’t use Track() method if you don’t need to track.

Tracking script is not injected on pages and statistics is not collected if Do Not Track header value equals 1. It indicates that the user does not want to be tracked and DNT has been explicitly enabled in browser.

Use it

Use statistics and optimize, make sure your visitors get what they are looking for!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.