Web tracking is enabled in Sitecore XP by default. Starting from Sitecore XP 10.0.0, there is a new feature used to exclude URL paths from tracking for any path, but not for *.aspx paths only. To not track any URL path in the earlier product versions, refer to the Solution section.
To exclude paths from tracking, consider one of the following options compatible with the affected product version:
- To disable Sitecore Analytics, and, hence, to exclude all paths from tracking, proceed as follows:
- For Sitecore XP 8.1.0 - 8.2.7:
- Disable xDB in the Sitecore.Xdb.config file as specified here.
- Disable xDB Tracking in the same Sitecore.Xdb.config file according to the following instructions.
- Set enableTracking attribute to "false" in all sites, defined in the section of your configuration.
- For Sitecore XP 9.0.0 - 9.3.0, use the following instructions.
- To exclude paths from web tracking, you can customize the behavior to prevent tracking of specific paths. Create an extra custom processor in the startAnalytics pipeline that will check the path and abort the pipeline based on that. The custom processor must go right after Sitecore.Analytics.Pipelines.StartAnalytics.CheckPreconditions default one. The following example of the code is given only as a starting point:
public class ExcludePath
{
public override string Process(PipelineArgs args)
{
var path = HttpContext.Current.Request.Url.AbsolutePath;
//you code for checking if path should be excluded
var pathIsExcluded = ...
if (pathIsExcluded)
{
args.AbortPipeline();
}
}
}
- Also, to prevent any path from being tracked, you can call the following method anywhere on the path you do not want to track:
Tracker.Current.CurrentPage.Cancel()