I'm just confused where the data being saved when we change the facets in Sitecore. This is my code
if (Tracker.Current != null && Tracker.Current.IsActive){
Tracker.Current.Session.Identify(Sitecore.Context.User.Name);
var contact = Tracker.Current.Session.Contact;
var contactPersonalInfo = contact.GetFacet<Sitecore.Analytics.Model.Entities.IContactPersonalInfo>("Personal");
contactPersonalInfo.JobTitle = foo.Content;
}
When I change the job title of the contact facets to "Cook Helper" the MongoDB took quite a while before being updated. But when debugging the contact facets already being set to Cook Helper. Where is the data then before being saved to MongoDB? Some temporary storage?
All the data you store in Tracker
, including facets, are stored in visitor's session.
When session ends, data is flushed to MongoDB.
This reduces the number of calls to the collection database, but it means that session management should be as robust as possible.
More info can be found in this article: Sitecore Session State and the xDB