Enable the web analytics tracking feature

Abstract

How to enable the web analytics tracking feature.

Tracking is a function of Content Delivery (CD) roles that you can enable or disable depending on the role's purpose. For example, tracking serves no purpose on a CD role that exclusively provides digital assets.

You must register activities such as goals, campaigns, outcomes, page events that you want to track. You do this by associating the activities with content items. For example, you can associate a campaign with a specific page so that when a contact visits the page the campaign is recorded in the interactions for that contact.

You can use Content Editor to associate activities to be triggered and tracked automatically, or you can do it programmatically with custom code to gain more flexibility.

To enable tracking programatically:

  1. Ensure that your layout contains the MVC helper or the VisitorIdentification tag.

    • If you are using ASP.NET MVC, use the MVC helper:

      @using Sitecore.Mvc.Analytics.Extensions
      
      @Html.Sitecore().VisitorIdentification()
      
    • If you are using ASP.NET Web Forms, use the VisitorIdentification tag:

      <!-- ASP.net>
      <sc:VisitorIdentification runat='server'/>
      
  2. Ensure that tracking is enabled. If you do not have a Sitecore XP license or have chosen to disable the xDB, you can still use some in-session personalization features.