Tracking is the process of storing statistical data about queries that visitors to the site have searched for, as well as the hits that they have clicked on.
The purpose of tracking is to help the content administrator to gain a deeper insight into the efficiency of the search functionality and to identify areas of improvement and optimization to better serve vistors with relevant content.
The recommended and standard way to enable tracking on your site is to call Track() on the search query.
When using Unified Search, Track() enables tracking of both the query and the hits. When using Track() on a non-Unified Search, it only enables tracking of the query. Refer to custom tracking below for information on how to achieve hit tracking for a non-Unified Search.
Note: The client side scripts used for tracking depends on having set the EPiServer.Framework.Web.RenderingTags in the page templates:
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<%@ Import Namespace="EPiServer.Framework.Web" %>
<%@ Import Namespace="EPiServer.Framework.Web.Mvc.Html" %>
<%= Html.RequiredClientResources(RenderingTags.Header) %>
You can utilise the StatisticsClient to implement a custom tracking mechanism. The StatisticsClient offers two methods: TrackQuery() and TrackHit().
Access the StatisticsClient as follows:
TrackQuery(), as the name suggests, is used to track the user query. It returns a TrackQueryResult with the TrackId.
You would typically implement this scenario when you are using a non-Unified Search, and have to manually enable tracking of hits.
This requires you to supply the required tracking information as querystring parameters in the hit URL.
The complete list of tracking querystring parameters is as follows:
TrackHit() is used to track a search hit. Stated in other words, it is a way to achieve click tracking. It takes a query and hit ID as parameters. The format of the hit id parameter is the same as described for the _t_hit.id querystring parameter above.
Last updated: Dec 15, 2014