Web tracking

Abstract

Overview of Sitecore contact and interaction tracking and untracked paths.

The Sitecore Web Tracker enables you to track and identify contacts and their interactions during their visit to your Content Delivery (CD) instance. You can use this information for:

  • Personalization of content based on behavior during the current session.

  • Historic personalization of content-based behavior during previous sessions through the the Key Behavior Cache and the Contact Behavior Profile.

  • Reacting to activities such as goals triggered during the current interaction.

  • Creating reports on site use.

  • Optimizing your website.

Important

For information about a contact's right to object to tracking and processing, see the Global privacy guide.

The Web Tracker is responsible for collecting contact activity and, at the end of the session, submitting it to a conversion pipeline that converts it and submits it to xConnect using the xConnect Client API.

Illustration showing the data flow from the Web Tracker through the conversion pipeline and to the xConnect Collection service and the xDB Collection database.

The data collection process goes through the following steps:

  • The Web Tracker collects page views and events as objects such as Sitecore.Analytics.Model.Entities.IContact,Sitecore.Analytics.Tracking.CurrentInteraction, and Tracker.Current.Interaction in the session.

  • When the session ends, the Web Tracker passes an args.TrackerVisitData object to a conversion pipeline, where multiple processors in the following order convert it into XConnect objects:

    • A processor inspects the args.TrackerVisitData object.

    • A processor converts the args.TrackerVisitData object into facets, properties, or events in the form of args.XConnectContact and args.XConnectInteraction objects. The processor does not convert custom values by default. You must create a custom processor to do this work.

    • A processor deletes the original args.TrackerVisitData object. Data collected by the tracker but not converted is lost forever.

    • A processor submits the XConnect objects to the xConnect Collection service, which stores them in the xDB Collection database for further processing.

  • When the contact returns for a new session, contact and interaction data from previous sessions is loaded from xConnect.

See the following topics for more information about tracking known and anonymous contacts, and how to identify a contact in a session:

The Web Tracker does not track paths that are listed in the tracking/untrackedPaths node in the App_Config/Sitecore/Marketing.Tracking/Sitecore.Analytics.Tracking.config file on the Content Delivery (CD) role.

In Sitecore 10.0, untracked pages configured with the tracking/untrackedPages node was deprecated in favor of untracked paths configured with the tracking/untrackedPaths node.

Untracked paths have the following advantages:

  • They support any URL path and can, for example, exclude MVC routes from tracking, as opposed to untracked pages that only supported web pages.

  • They support regular expressions in path definitions. For example, you can disable tracking for all paths starting with /api/service with the <add desc="exclude all requests start with api/service" regex="^\/api\/service"/> regular expression.

Important

To prevent the new add node to be merged with other add nodes, you must set the desc attribute with a unique value.

By default, the tracking/untrackedPaths node contains a list of service pages:

<tracking>
    <untrackedPaths>
      <add desc="default page" path="/sitecore/default.aspx" />
      <add desc="error page" path="/sitecore/service/error.aspx" />
      <add desc="heartbeat page" path="/sitecore/service/Heartbeat.aspx" />
      <add desc="keepalive page" path="/sitecore/service/keepalive.aspx" />
      <add desc="nolicense page" path="/sitecore/service/nolicense.aspx" />
    </untrackedPaths>
  </tracking>

If your Sitecore installation has other paths like the service pages, you can prevent them from being tracked and avoid that they create irrelevant data in your reports. Examples of such paths are keepalive pages, or pages you use for registering system events.

Paths are referenced by their relative URLs, and we recommend that you add them using patch files instead of editing the config files directly.

In the the Sitecore.Analytics.Configuration.AnalyticsSettings class, you can access the following properties programmatically:

  • UntrackedPaths - the list of untracked paths.

  • UntrackedPathPatterns - the patterns of URLs excluded from tracking.

You can track the following data, but remember to inform the contacts of what you are doing:

Data

System enabled

Content Editor/programmatically enabled

Contacts

Yes

Interactions

Yes

Browser information (name and version)

Yes

Campaigns

Yes

Channels

Yes

Engagement value

Yes

Goals

Yes

IP Geolocation

Yes

Multivariate tests

Yes

Operating system

Yes

Page events

Yes

Pages viewed

Yes

Profile values

Yes

Referrer

Yes

Screen height/width (where available)

Yes

Search keywords

Yes

Start date/time and end date/time

Yes

User agent

Yes

Outcomes

Yes

Note

  • Page events and Goals are both triggered in the same way programmatically.

  • The Web Tracker does not track programmatically enabled items by default. You must enable tracking in Content Editor or in the code to gather information about these items.