2

So we are working with xDb and we would like to collect data about the user when they are anonymous but haven't been identified using:

Sitecore.Analytics.Tracker.Current.Session.Identify(emailAddress);

Is this possible, to store information such as their Name, etc without having them identified based on their e-mail?

4

If you question is how to do it in code, then this is the code you want.

IContactPersonalInfo personalFacet = Tracker.Current.Contact.GetFacet<IContactPersonalInfo>("Personal");
personalFacet.FirstName = "Bobby";
personalFacet.Surname = "McGee";

If you question is theoretical, then the answer is yes. In a project I am working on right now. I have created custom facets that match a registration form the user is filling out. As the user moves from one field to another, I am making an API call to store the already filled out data in xDB. Like first name, email, gender, etc... When the user comes back with the same browser, I pull that data out of xDB and fill in the form for then. This lets the pick up where they left off.

The identification an "Unidentified" user is from a cookie Sitecore drops on the user's browser. In our case, once the user registers, we fully identify them in xDB.

| improve this answer | |
  • That's actually what I thought, but wanted to confirm with a code sample. So if you save this data while the user is anonymous (or not identified) it will store and save this information. Then once you identify the user it will merge that information, correct? – Dylan Young Sep 13 '17 at 21:35
  • I wouldn't call it merge because the contact ID and object, before and after, are the same. Its just now identified. BUT IF the user is already identified on their phone browser and was just identified on their work PC. Then the interactions and contacts between the two are "merged". – Chris Auer Sep 13 '17 at 21:39
  • Okay so in the case of the same user that uses a desktop and also a mobile device, once they are identified (by their e-mail address in the example I'm using) on both devices, that users contact info (one from the desktop and another from mobile) are merged into one? – Dylan Young Sep 13 '17 at 21:42
  • 1
    Yes, that is correct. We used to have to do any custom facets ourselves. Now Sitecore does it all for us. You can read about how we use to do it here. jonathanrobbins.co.uk/2016/01/20/… – Chris Auer Sep 13 '17 at 21:45
4

Yes, Sitecore will still store the data. As a general rule, Sitecore does not throw out good analytics data, regardless of whether or not the visitor has been identified. In fact, what you are looking to do is actually the default behavior, if you are to exclude the visitor identification logic that you included in your post.

Think of visitor identification more as "visitor recognition". If Sitecore doesn't "recognize" a visitor as an existing contact it simply creates a new one. The default behavior of Sitecore is actually to create a new contact for every visitor. Through the use of identification code, like the logic that you specified in your post, this behavior is changed such that repeat visitors can be "recognized" and their experience can be improved by using their historical tracking data.

Once a visitor has been "recognized" or identified, the new contact that Sitecore created for the visitor is merged with the existing one. Once the session ends and the contact is flushed to Collections (MongoDB) the merged contact data is saved over the existing data for the contact.

In contrast, if a user is never "recognized" or identified, once the session ends the visitor's tracking data is flushed to Collections (MongoDB) and stored as a new contact. When a person makes a repeat visit to the site, if they - as a visitor - are never "recognized" or identified as an repeat visitor (i.e. never matched to an existing contact) then a new contact will be created for the visit. If visitor identification logic is never employed, then there will be a separate contact for each visit that a person makes to the site, since Sitecore will not know how to identify a visit as a repeat or new visit.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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