Identifying contacts

Current version: 8.2

The Sitecore Experience Database (xDB) contains both unidentified and identified contacts. 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.

Unidentified contacts

Every time a contact uses a device to interact with your website xDB creates a new contact record. New contacts enter the system as unidentified contacts because the only information collected at this point relates to the browser or device used. This is not enough to identify an individual across multiple devices.

Contacts are connected to the devices they have been using but remain unidentified in the system until they provide a valid identifier. Clearing cookies in the browser breaks the connection between the contact and the device.

At this stage, you only know about the device, not the person using it. For the system to identify a contact, the individual must provide personal information, such as an email address in exchange for greater access to the services and information on your website.

Identified contacts

Depending on your requirements, there are different identification strategies that you can implement to identify contacts across their devices. For example:

  • Introduce a login form.

  • Connect to contacts using their given email address or phone number and SMS authentication. These all require you to integrate with the Sitecore platform calling the Identify() API call when applicable.

  • Email Experience Manager (EXM) and the Web Forms for Marketers (WFFM) modules integrate with Sitecore to identify contacts when they open email links or complete a web form.

All contact information, as well as an identified contact's history, can be accessed across multiple devices. When a contact identifies themselves using a particular device or browser, Sitecore stores the connection details and, by default, retains this association for the subsequent sessions that follow.

The identification process

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.

You can access this method using the following path:

  • Sitecore.Analytics.Tracker.Current.Session.Identify (identifier)

The contact is identified by an identifier. The contact identifier is a string value that is either supplied by the contact or is based on information supplied by the contact that uniquely identifies them in relation to the website.

Some examples of identifiers are:

  • A user login name

  • A user ID in a security system

  • An email address

Note

Sitecore XP assigns a unique contact ID value to each contact. This is a GUID that is used internally in the system.

Calling the identification process

The following code sample of the OnLoad() method embedded in an ASPX page illustrates how to identify the contact based on two query string parameters, login and password. It refers to solution-specific security subsystem that is represented by a security object, which validates the contact using password protection and then invokes the Identify () method.

RequestResponse
  protected override void OnLoad(System.EventArgs e)
  {
    string login = Request.QueryString["login"];
    string password = Request.QueryString["password"];
    // use the security system (application-specific) to validate password.
    if (Security.IsValidPassword(login, password))
    {
      // the following call will identify the current contact/device as the person with the given login.
      Sitecore.Analytics.Tracker.Current.Session.Identify(login);
    }
    // show the identifier of the current contact.
    Response.Write(Sitecore.Analytics.Tracker.Current.Contact.Identifiers.Identifier);

The Identify () method

The identification process includes various actions depending on the context and information stored in the xDB. The Identify () method behaves differently in the following situations:

  • When the current contact is unidentified – information in an unidentified contact record merges with the identified contact, making the unidentified contact record obsolete and replacing it with a pointer to the identified contact record. After merging, the context contact is deleted from the session state. The merged contact includes custom contact facets, EAS states and interaction history.

  • When the current contact is an identified contact – current interaction is terminated and a new interaction for the identified contact begins. The new interaction begins on the last page of the terminated interaction, and the link between the current device and the identified contact is updated.

  • When the provided identifier points to a contact which has an active session on another cluster – the current session is interrupted to transfer the context device and contact sessions to the target content delivery cluster.

  • When the provided identifier does not correspond to an existing identified contact record – the current contact record is saved to the xDB and the identified contact record connects to the identifier. The context device session and the current interaction are assigned to the contact record and connect to the provided identifier. If the current contact record is an identified contact that is connected to another identifier, a new contact record is created.

Note

Identified contacts are never overwritten or deleted. However, it is possible to remove personal and history information by updating the contact record.

Do you have some feedback for us?

If you have suggestions for improving this article,