1. Tracking contacts

Add identifiers to a contact

Version:

There are two ways to add an identifier to a contact with an ongoing session:

  • If a contact is anonymous, use IdentifyAs(). If the contact does not exist, a new identifier will be added - this identifier will be available in Sitecore.Analytics.Tracker.Current.Contact.Identifiers.

  • If a contact is known and you wish to add a secondary identifier, use contactManager.AddIdentifier(). This identifier will not be available in Sitecore.Analytics.Tracker.Current.Contact.Identifiers, as the tracker does not reload a contact after AddIdentifier() is called.

You can also use the xConnect Client API directly to add an additional identifier - contactManager.AddIdentifier() uses the xConnect Client API behind the scenes.

If you have suggestions for improving this article, let us know!