Contact facets in the tracker
Overview of contact facets and how they are used in the tracker.
Facets that are loaded into session can be edited but are not saved to xConnect on session end. You must use the xConnect Client API to update facets.
Facets are represented by the
Sitecore.Analytics.Tracker.Current.Contact.Facets dictionary in the tracker and are loaded from xConnect into shared session state at the start of a session. The tracker does not lock contacts in session, and changes made to facets stored in
Sitecore.Analytics.Tracker.Current.Contact.Facets are not saved on session end.
// Legacy facet // NOT SAVED ON SESSION END var personalInfo = Sitecore.Analytics.Tracker.Current.Contact.GetFacet<IContactPersonalInfo>("Personal"); personalInfo.FirstName = "Myrtle"; // xConnect facet // NOT SAVED ON SESSION END var xConnectFacets = Sitecore.Analytics.Tracker.Current.Contact.GetFacet<IXConnectFacets>("XConnectFacets"); PersonalInformation personalInfoXConnect = xConnectFacets.Facets[PersonalInformation.DefaultFacetKey] as PersonalInformation; personalInfoXConnect.FirstName = "Myrtle";
Facets are not automatically reloaded
Facets that have been cached in shared session state are not automatically reloaded when you use the xConnect Client API to submit changes to xConnect. You must manually update the cached facets or reload the contact from xConnect.
Personalization relies on facets that have been cached in shared session state. Keep cached facets up to date in order to ensure that personalization is acting on the latest available data.