Add identifiers to a contact
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 inSitecore.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 inSitecore.Analytics.Tracker.Current.Contact.Identifiers, as the tracker does not reload a contact afterAddIdentifier()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.