The Disable Analytics
option on item is used during the Processing/Aggregation activities of Sitecore Analytics, specifically the processItem pipeline.
<processItem patch:source="Sitecore.Analytics.config">
<processor type="Sitecore.Analytics.Pipelines.ProcessItem.CollectParameters,Sitecore.Analytics"/>
<processor type="Sitecore.Analytics.Pipelines.ProcessItem.TriggerCampaigns,Sitecore.Analytics"/>
<processor type="Sitecore.ExperienceExplorer.Business.Pipelines.ProcessItem.InteractionValuePipeline, Sitecore.ExperienceExplorer.Business" patch:source="Sitecore.ExperienceExplorer.config"/>
<processor type="Sitecore.Analytics.Pipelines.ProcessItem.RegisterPageEvents,Sitecore.Analytics"/>
<processor type="Sitecore.ExperienceExplorer.Business.Pipelines.ProcessItem.SaveInitialProfilesPipeline, Sitecore.ExperienceExplorer.Business" patch:source="Sitecore.ExperienceExplorer.config"/>
<processor type="Sitecore.Analytics.Pipelines.ProcessItem.ProcessProfiles, Sitecore.Analytics"/>
<processor type="Sitecore.ExperienceExplorer.Business.Pipelines.ProcessItem.ProfilesPipeline, Sitecore.ExperienceExplorer.Business" patch:source="Sitecore.ExperienceExplorer.config"/>
</processItem>
The reason you are seeing the error pop-up, even on the default FeedDeliveryLayout is because of the startAnalytics pipeline. As Dmytro points out, manually setting the Tracker.Enable
to false on the layout is a way of telling Sitecore to ignore tracking for that request, which checked in the CheckPreconditions
processor of the same pipeline.
Interesting to note, other reasons why this pipeline would not proceed:
Tracker.Enable
is false
SiteContext
is null
Context.Page
is null
site.Tracking().EnableTracking() is
false`
<startAnalytics patch:source="Sitecore.Analytics.Tracking.config">
<processor type="Sitecore.Analytics.Pipelines.StartAnalytics.CheckPreconditions, Sitecore.Analytics"/>
<processor type="Sitecore.Analytics.Pipelines.StartAnalytics.CreateTracker, Sitecore.Analytics"/>
<processor type="Sitecore.Analytics.Pipelines.StartAnalytics.StartTracking, Sitecore.Analytics"/>
</startAnalytics>
Specifically the StartTracking
processor:
public class StartTracking
{
public virtual void Process(PipelineArgs args)
{
Assert.ArgumentNotNull((object) args, "args");
Assert.IsNotNull((object) Tracker.Current, "Tracker.Current is not initialized");
Tracker.Current.StartTracking();
Log.Debug("[Analytics]: Start tracking: " + (object)
... code snipped ...
}
}
The Assert is Not Null is throwing the error. If you wanted to manually fix the way this reports, you could create a custom processor that goes before StartAnalytics
, and instead of doing a Assert.IsNotNull
at the begging, you could check for null, perform a Log.Debug()
signifying that the Tracker is null here, and then gracefully abort out of the pipeline.
public class CheckNullTracker
{
public virtual void Process(PipelineArgs args)
{
Assert.ArgumentNotNull((object)args, "args");
if (Tracker.Current == null)
{
Log.Debug("Tracker.Current is not initialized");
Tracker.Enabled = false;
args.AbortPipeline();
}
}
}
The above custom processor is more of a fundamental example. Care
should be taken. The Tracker.Current
use case is utilized in a whole
bunch of pipeline processors and other areas. Appropriate uses of Tracker should always include a check to ensure Tracker.Current
is not null
.