4

Let's imagine we were using a sitecore username as an identifier (example), but later we realized that it is better to use an email as an identifier.

So, we started identifying our visitors using their email rather then username.

However, what happens to the old data? Will it be automatically merged or there will be two distinct contacts?

Also what are the general implications of changing the contact identifier?

2
  • 2
    Have you seen this question? That is one of the possible consequences of changing the identifier. sitecore.stackexchange.com/questions/4029 Commented Feb 13, 2017 at 13:32
  • @DmytroShevchenko thank you. that seems reasonable and looks like a sitecore defect. Though I will leave this question open for community suggestions Commented Feb 13, 2017 at 13:38

1 Answer 1

2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.