I have the following method
GetValue()
{
var value = Tracker.Current.Contact;
}
That always executes.
However when I invoke the above method from the ItemResolver pipeline, Tracker.Current is always null.
public class CustomItemResolver : HttpRequestProcessor
{
public override void Process(HttpRequestArgs args)
{
GetValue();
}
}
What am I missing here?
Tracker is initialized during
startAnalyticspipeline, which is started by therenderLayoutpipelineSitecore.Analytics.Pipelines.HttpRequest.StartAnalyticsprocessor.If you really need Tracker to be initialized earlier, you can use the following method:
Remember that Sitecore starts Tracker much later and I'm quite sure there is a reason they don't do this before
ItemResolver, so you're doing it on your own responsibility.