When using the Identify()
method and switching identifiers, because the contact is known, Identify() won't merge the contacts like it would for an anonymous original contact.
So the end result is that you will have two contacts in xDB, one for each identifier. The information isn't lost, but it's not tracked as one contact.
That's where ContactManager would come into play.
There is a public method on ContactManager called MergeContacts
.
public void MergeContacts(Contact survivingContact, Contact dyingContact)
{
Sitecore.Diagnostics.Assert.IsFalse(survivingContact.IsReadOnly, "Cannot save a read-only contact to XDB.");
Sitecore.Diagnostics.Assert.IsFalse(dyingContact.IsReadOnly, "Cannot save a read-only contact to XDB.");
if (this.repository == null)
return;
this.repository.MergeContacts(survivingContact, dyingContact);
}
I would use this method, and maybe a script (see Dmytro's link in comment for approaches) and use this method to merge the contacts, and "kill" off the Dying Contact, and "keep" the Surviving Contact