2. Contacts – Quick Overview
A contact represents an individual who interacts with or may potentially interact with your
organization, it contains information about an individual from their interactions across
channels, devices and websites.
xDB stores information about the contact such as
An individual's name, E-mail addresses, Phone numbers, Profile picture, Behavior profile,
Interaction history, Outcomes, Engagement automation states
Customized data
Unidentified and identified contacts.
3.
4. Ecommerce - use case example
Amazon
Device -> Website
Contact -> Website
Another Device -> Website
Another Device + Identified contact -> Website
5. Identifying Contacts
Why Identify Contact ?
Identifying contacts is important in order to get a consolidated and detailed view of a contact's
entire journey and experiences on your website and to recognize returning contacts regardless of the
device they use.
How to identify contacts in Sitecore ?
Contact identification is the process of connecting the current session, device and contact session
to an identifier. This is implemented using the Identify() method which is part of the Sitecore Analytics
tracker namespace.
Sitecore.Analytics.Tracker.Current.Session.Identify (identifier)
Identified contacts are never overwritten or deleted. However, it is possible to remove personal and
history information by updating the contact record.
Merging Contacts :
- DyingContact -> SurvivingContact.
7. Contact Facets ?
Contact facets are hierarchical data structures that group related attributes together into a
single unit stored on the contact. The contact entity consists of a unique identifier, internal
system data structures, and a set of facets
System - used by the system. These cannot be removed or disabled.
Standard - commonly used facets that come as standard with Sitecore.
Custom - created specifically for your organization.
The data stored in facets can be organized in:
Attributes
Elements
Dictionaries
8. Creating a custom contact facet.
Why?
Some use cases:
Premium content should be visible to only premium users.
User Preferences.
- e.g. - Show a message on page until user click’s “Don’t show this message”.
9. Steps to create a custom facet.
Create a contract
Implement the contract
Configure the system to use the new facet
Update the model configuration
11. 2. Implement the contract
Register the attributes, collections, and dictionaries with the base class in the
constructor using the following helper methods, it ensures that the member is
registered with the model
Make sure the class is marked with the [Serializable] attribute. This attribute is
required to ensure that instances of this class can be stored in shared session and in
the submit queue.
Before starting custom contact facets, we will quickly go through Contacts, Identifying contacts and then will start with Custom Contact Facets.
Unidentified and identified contacts : When a contact first interacts with your website they start out as an unidentified contact in the system until they provide enough information to be identified. Once a contact has been identified, the unidentified contact is replaced with the identified contact record.
Contacts are identified by their unique identifier. This is a GUID-based Sitecore identifier, and optionally, by their string-based custom identifier, such as an e-mail address. Both are guaranteed to be unique within the xDB. Contacts that have a string-based custom identifier set are referred to as known contacts.
Contact Data Model : The contact entity contains multiple data entries, which are grouped into facets and stored in the xDB.
Screen shot of robomongo - identified and unidentified contacts.
Target is to clarify : Contacts concept.
Custom contact facets needs a custom processor using the MergeContact pipeline to merge custom contact facets.
Question: Extending standards OOTB facets is possible?
Creating a contract, defines the structure of elements or facets
To define a contract for an element, implement an interface that extends the IElement interface. For facets, extend the IFacet interface.
Simple attribute such as an integer, a date-time, a GUID, a string, or a floating-point number, add a property with both a getter and a setter that returns the type you need.
To add a child element, define a property with a getter only that returns the contract of the element in question.
To add a dictionary or collection of child elements, define a property with a getter only
We need to create concrete classes implementing interfaces.
Question I asked before!
Once we have defined and implemented the facet structure, you must configure Sitecore to use the new facet.
Facet is also an Element. It’s just a special Element.
In this example, the node <entity> is replaced with the entity type that you are extending, for example, <contact>. The name attribute is the name under which the facet is accessible on the contact model. This is the string value passed to the GetFacet<TFacet>( string name ) method.