15

I am getting below error in logs and none of the interaction data is collected in mongoDB also. Verified with Post looks everything Ok in my solution.

ERROR Cannot create tracker.
    Exception: System.InvalidOperationException
    Message: session is not initialized
    Source: Sitecore.Analytics
       at Sitecore.Analytics.Data.HttpSessionContextManager.GetSession()
       at Sitecore.Analytics.Pipelines.EnsureSessionContext.EnsureContext.Process(InitializeTrackerArgs args)
       at (Object , Object[] )
       at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
       at Sitecore.Analytics.Pipelines.EnsureSessionContext.EnsureSessionContextPipeline.Run(InitializeTrackerArgs args)
       at Sitecore.Analytics.DefaultTracker.EnsureSessionContext()
       at Sitecore.Analytics.Pipelines.CreateTracker.GetTracker.Process(CreateTrackerArgs args)
       at (Object , Object[] )
       at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
       at Sitecore.Analytics.Tracker.Initialize()


  [1]: https://stackoverflow.com/questions/34083886/xdb-not-storing-any-interactions/34085142

Another error in log related to analytics I can see is below

3608 07:08:13 ERROR Media request analytics failed
Exception: System.InvalidOperationException
Message: Tracker.Current is not initialized
Source: Sitecore.Analytics
   at Sitecore.Analytics.Pipelines.StartAnalytics.StartTracking.Process(PipelineArgs args)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Analytics.Pipelines.StartAnalytics.StartAnalyticsPipeline.Run()
   at Sitecore.Analytics.Media.MediaRequestEventHandler.StartTracking()
   at Sitecore.Analytics.Media.MediaRequestEventHandler.OnMediaRequest(Object sender, EventArgs args)
12
  • Check if you have below processor added to Sitecore.Analytics.Tracking.config in createVisit pipeline, if not added it. <processor type="Sitecore.Analytics.Pipelines.CreateVisits.InitializeWithRequestData, Sitecore.Analytics" />
    – navincumar
    Jan 4, 2017 at 11:02
  • What is your version of Sitecore? Jan 4, 2017 at 11:53
  • navincumar- it is there .
    – FHN
    Jan 4, 2017 at 11:55
  • @DmytroShevchenko Sitecore 8.1 update 2
    – FHN
    Jan 4, 2017 at 11:55
  • Do you have any other log errors that we should know about? Jan 4, 2017 at 12:00

3 Answers 3

8

I have experienced both of the errors that you mention in an 8.1.2 instance - sometimes together and other times separately. The below are the most common causes and solutions for these issues, in my experience.

Note that it is possible for you to have more than one of these issues at a time.

Tracking and xDB Disabled...

The Tracker.Current is not initialized error most commonly occurs when you have xDB or Tracking disabled. Open your ShowConfig and verify that the Xdb.Enabled setting and the Xdb.Tracking.Enabled are set to true, and ensure the enableTracking="true" on your <site> configuration node.

Note that I am including this information as it may help others, but is most likely not the cause of your issue, since you also have session is not initialized error. However, if you do not get the session is not initialized error on your CM, this could be the cause of the issue on that instance and a different issue may exist on your CDs.

Initialize Pipeline Errors or Aborts...

Make sure that you don't have any errors or aborts in your initialize pipeline processors. If you do, this could be preventing the pipeline from reaching the Sitecore.Analytics... processors that initialize your Tracker.

Session State Configuration is incorrect...

This issue is sometimes caused by a error in Session State configuration, causing Session to be null and/or keeping it from being initialized. If this issue is happening on your CDs only, make sure that your CDs are correctly configured to use Shared Session State, and that there are no issues with your configuration (the most common issue I see is pointing your session provider at the wrong connection string name).

If you are using xDB Cloud...

If you are using xDB Cloud, reach out to Sitecore support and make sure that everything is associated properly with the license that you are using.

I have seen this error occur when an instance is configured to use xDB Cloud but the license on the server is not the one authorized for the xDB Cloud account. In other words, if your client purchased xDB Cloud but you have your Partner License up on the site or if there is a problem with your client's license then this error can occur.

You can sometimes identify this error by looking in your logs and checking for the "Valid xDB license present" message on initialize. However, if your license has an xDB Cloud license associated with it (which all up-to-date partner licenses should) then you will see this message, whether or not your license is associated with the same xDB Cloud account as you are connecting to.

If you are not using xDB Cloud...

If you are not using xDB Cloud but you are using a separate Reporting instance, be sure that you are able to connect to it as expected.

2
  • Zachary Kniebel Issue is on CD as well as CM both, I am trying to focus on CM - In CM default Inproc session is being used, and expected configuration are there. I have 1 CM, 4 CD, 1 Processing , Mongo replicaset(1 Primary, 1 Secondary, 1 arbitor) architecture. Checked connection of mongo servers from each sitecore server, looks fine. investigating on pipeline processor you mentioned.
    – FHN
    Jan 6, 2017 at 2:29
  • @Zachary Kniebel I'm seeing the same error reported by FHN but have Xdb.Tracking.Enabled=true and Xdb.Enabled=false deliberately (we're not using MongoDBs etc and just need some simple personalisation rules to run). Do you have any ideas how I could address the error in that case? Apr 16, 2018 at 11:26
2

Cannot Create Tracker or Tracker.Current is Not Initialized - Common Fixes

In almost every scenario that I have faced myself, as well as helping others, I have come to the utmost conclusion, that every single time this issue comes up is because of the following reasons:

Reason 1: Analytics.ClusterName is configured incorrectly.

The Analytics.ClusterName which is set in the Sitecore.Analytics.Tracking.config needs to be a legitimate, resolvable hostname. The default "default-cd-cluster" is not enough to promote a working solution. This value has to be a dns name that all Sitecore Servers can reach (e.g. cd.cluster.domain.com for example).

  • Ensure that each server, at a minimum has the configured Analytics.ClusterName in the windows host file and configured to point to an IP address of a Content Delivery server.
    • If on a content delivery server, set this host file IP equal to localhost, which is 127.0.0.1.
    • If on a content management or other server, set the host file IP value equal to the IP of ONE of your CD servers. Do not set it to the load balancer IP (unless that can be reached by your network)

Reason 2: Analytics.Hostname is Incorrect

It has been my experience that setting a value for Analytics.Hostname, located in the Sitecore.Analytics.Tracking.config file does more harm than good. I have found leaving this value BLANK, makes everything work as it should.

Reason 3: Sitecore.Context.Page is not available.

Sitecore's Analytic Tracker requires that the Sitecore.Context.Page object be available in order for Tracker to be initialized. In certain cases where this object is not available, and Tracker tries to be started, it will throw this error.

Tracker cannot be utilized on ASHX's, internal pipelines or thread processes where Page is not set.

Utilization of Tracker on Content Management Servers.

Pure (role configured) Content Management servers do not utilize session state management, and therefore can not run Tracker natively. Instead, they rely on the Analytics.ClusterName to resolve in order to communicate a session back to the Content Delivery servers. In cases where on the Content Management server, you receive these types of errors, it is because Analytics.ClusterName is not correctly setup and reachable.

This also applies to Processing Servers, EXM Dispatch Servers, and Secondary Content Management Servers.

Want a Deep Dive Look?

Here is a link to a blog post that I just published today as a result of this answer. In addition, I go into a deep dive behind the covers to reveal what's really going on when the Tracker is initialized and WHY the Analytics.ClusterName is so important.

1

My guess is you have disabled Sitecore.Analytics.RobotDetection.config file (as suggested by Sitecore for CM Server) but you have not disabled the related module on Web.config files. In system.webServer/modules type of MediaRequestSessionModule module should be changed from Sitecore.Analytics.RobotDetection.Media.MediaRequestSessionModule, Sitecore.Analytics.RobotDetection to Sitecore.Analytics.Media.MediaRequestSessionModule, Sitecore.Analytics.

However, this has no effect in your analytic data collection. Zach mentioned a few good points and Sitecore has a good KB article on this as well that you can refer to https://kb.sitecore.net/articles/977445

My suggestion is double confirm your CD server configration according to Sitecore Disable Enable Excel sheet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.