Search code examples
sitecoresitecore8sitecore-xdb

Sitecore Tracker is null after login with specified user


I've doubt related with Sitecore.Analytics.Tracker and how sitecore tracks user information. This is the current version that i'm using - Sitecore.NET 8.1 (rev. 160519) with MVC

I have a page for Login where I'm doing the manual login against sitecore and Tracker.Current is always null.

And i want to create a Contact for the logged in user, or validate if there's any, to fill user info.

Searched in showconfig.aspx for Analytics.Enabled and there were no results in it. All database connection strings are correct.

Thanks in advance.

Code example:

string domainUser = Sitecore.Context.Domain.GetFullName(model.Username);

if (System.Web.Security.Membership.GetUser(domainUser) != null)
{         
   bool logged = AuthenticationManager.Login(domainUser, model.Password, false);
   ....
}

UPDATE:

ViewBag.XdbSettings = "Empty";
if (XdbSettings.Enabled)
    ViewBag.XdbSettings = "Enabled";

ViewBag.HasValidLicense = "Empty";
if (XdbSettings.HasValidLicense)
    ViewBag.HasValidLicense = "HasValidLicense";

ViewBag.Tracking = "Empty";
if (XdbSettings.Tracking.Enabled)
    ViewBag.Tracking = "Enabled";

ViewBag.Comment = "Empty";
if (Tracker.Current != null)
    ViewBag.Comment = "Not Null";


XdbSettings: Enabled
HasValidLicense: HasValidLicense
Tracking: Enabled
Comment: Empty

Solution

  • In Sitecore 8.1, the name of the setting you're looking for has changed to Xdb.Enabled. You should check for both Xdb.Enabled and Xdb.Tracking.Enabled to be present and set to true. These settings are located in App_Config/Include/Sitecore.Xdb.config.

    Also, verify that you have other xDB-specific configuration files, such as Sitecore.Analytics.config and Sitecore.Analytics.Tracking.config.

    Also, check that the enableTracking attribute is set to true for the appropriate <site> element in your Sitecore.config.

    Also, follow this troubleshooting guide by Sitecore.