Contact identifiers

A contact identifier uniquely identifies a contact to systems outside the xDB. Examples of valid identifiers include website logins, social media handles, and ad network IDs. Identifiers are represented by the Sitecore.XConnect.ContactIdentifier class. Each identifier consists of:

  • An Identifier, such as a username
  • An identifier Source, which describes where the identifier comes from - such as ‘twitter’
  • An identifier ContactIdentifierType, which is either ContactIdentifierType.Anonymous or ContactIdentifierType.Known

Tip

The IsKnown property on the Sitecore.XConnect.Contact returns true if a contact has any known identifiers.

At the data storage level, contact identifiers are stored in a separate table or collection. The following restrictions apply:

  • The Identifier and Source properties are case sensitive - comparisons are done at byte level.
  • Identifiers and source are stored as VARBINARY. Identifiers are restricted to 700 bytes, and source is restricted to 50 characters.

Identifier uniqueness

Contacts are uniquely identified by a combination of Identifier and Source. This requirement supports the following scenarios:

  • A contact using the same username across multiple systems - for example, using myrtlesitecore on Twitter as well as Slack
  • Two different contacts using the same username - for example, contact 1 using sitecore on Instagram and contact 2 using sitecore on Twitter

A contact can have multiple identifiers

A single contact can have multiple identifiers. A contact’s identifiers are represented by the Identifiers property on the Contact class. Refer to the following topics for information about how to work with identifiers:

Tracker identifier

Contacts that have interacted with your website have a tracker identifier, which is created the first time a contact visits your website. This applies to known and anonymous contacts. A tracker identifier consists of:

  • An ID that is used exclusively by the tracker and differs from the contact’s ID in the xDB. This ID is generated by the tracker on session begin.
  • A source represented by the Sitecore.Analytics.XConnect.DataAccess.Constants.IdentifierSource constant (Use “xDB.Tracker” in 9.0.0 - property is marked internal).

Important

Do not rely on all contacts having a tracker identifier. Only contacts that have visited your website will have a tracker identifier.

Alias identifier

All contacts have an anonymous alias identifier that is assigned during the AddContactOperation. Alias identifiers ensure that contacts always have at least one predictable identifier, and is used by products such as the List Manager. An alias identifier consists of:

  • An ID that is generated by the xConnect service layer and differs from the contact’s ID in the xDB.
  • A source represented by the Sitecore.XConnect.Constants.AliasIdentifierSource constant (Use “xDB.Tracker” in 9.0.0 - property is marked internal).

Important

Contacts can only have one alias identifier. If you try to add an additional identifier that uses the Sitecore.XConnect.Constants.AliasIdentifierSource source, you will get an exception.