I'm using 9.1.1, and at the moment all of the contacts I have in experience profile are coming back as unknown. For our system, you have to log in to use anything beyond the homepage, and as part of the login process I have the following script to set up a contact card for the user; this is called each time. My main layout has the VisitorIdentification call as well.

        private static void TrackUserInSitecore(UserProfile profile) {
        if (!Tracker.IsActive || Tracker.Current.Contact == null) {

        try {
            Contact trackContact = Tracker.Current.Contact;
            IContactPersonalInfo personalFacet = trackContact.GetFacet<IContactPersonalInfo>("Personal");
            personalFacet.FirstName = profile.GetCustomProperty(Constants.UserProfile.FirstName);
            personalFacet.MiddleName = profile.GetCustomProperty(Constants.UserProfile.MiddleInitial);
            personalFacet.Surname = profile.GetCustomProperty(Constants.UserProfile.LastName);
            personalFacet.Nickname = profile.GetCustomProperty(Constants.UserProfile.Alias);
            personalFacet.JobTitle = profile.GetCustomProperty(Constants.UserProfile.Role);

            IContactEmailAddresses emailFacet = trackContact.GetFacet<IContactEmailAddresses>("Emails");
            IEmailAddress emailAddress;
            const string type = "Primary";

            if (!emailFacet.Entries.Contains(type)) {
                emailAddress = emailFacet.Entries.Create(type);
                emailAddress.SmtpAddress = profile.Email;
                emailFacet.Preferred = type;
            } else {
                emailAddress = emailFacet.Entries[type];
                emailAddress.SmtpAddress = profile.Email;

            IContactPhoneNumbers phoneFacet = trackContact.GetFacet<IContactPhoneNumbers>("Phone Numbers");
            IPhoneNumber phoneNumber;

            if (!phoneFacet.Entries.Contains(type)) {
                phoneNumber = phoneFacet.Entries.Create(type);
                phoneNumber.Number = profile.GetCustomProperty(Constants.UserProfile.PhoneNumber);
                phoneFacet.Preferred = type;
            } else {
                phoneNumber = phoneFacet.Entries[type];
                phoneNumber.Number = profile.GetCustomProperty(Constants.UserProfile.PhoneNumber);
        } catch (Exception ex) {
            _logRepository.Error($"Error setting contact card for {profile.UserName}", ex);

Is this a scenario where perhaps I'm not calling a "commit" to lock this data in place so it appears in experience profile, or I'm going overkill in putting this data into a contact card "fresh" each time? My logout process does a Session.Abandon so I can quickly check if the data is processed.

(In writing this question out I did notice this question/answer as well: Timeline always showing contact as unknown in Sitecore 9. I'm going to look at that in addition, but I'd like to make sure my basic contact tracking concept is correct as well.)

  • Like Mohammed says below, you have to IdentifyAs the contact to turn them from anonymous to known. That way all future sessions when they log in, will be merged. With your code, you will have 100 contact/sessions with the same email address.
    – Chris Auer
    May 6, 2020 at 0:40

1 Answer 1


What you're trying to do is identifying Sitecore Contact, you first need to identify contact using a unique value like email address from user profile in your case, as:

Sitecore.Analytics.Tracker.Current.Session.IdentifyAs("sitecoreextranet", "myrtlesitecore");

Following is Sitecore 9.1 documentation for identifying a contact:


Also, In the following Sitecore doc you can find a detailed example of setting contact facets:


  • Cheers, thanks for the references! I was able to adapt the code there into a new tracking class that I was able to make generic for reuse. May 7, 2020 at 14:29

Your Answer

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

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