Solved

Duplicate Profiles & Customer IDs

  • 16 April 2021
  • 8 replies
  • 1926 views

Userlevel 2
Badge +6

Firstly, the API doc says:

If you choose to use your own unique identifier with the $id key, you take on the full responsibility of identity management within your Klaviyo account. You must ensure that all calls are made mapping the right $id value you're setting to the right $email. If you send some calls with $id only, these profiles will exist without any associated $email. If calls then come in for the same person, but only $email is part of the request, a permanent duplicate profile will get created for the same person. Given the complexity of ensuring $id and $email are mapped correctly with every call across all data sources, we recommend exclusively using email address to identify individuals.

 

Because of this I originally planned to NOT give our internal ID information to Klaviyo.  However, I was unable to figure out how to update a customer email address without creating a new account (preserve order/browse history) if I didn’t have the unique ID.

Therefore, I inserted the $id into customer profiles ALONG with $email.  Now I can update email address and keep profile data.  Works fine.

I do not have the $id always declared, but, I always have $email declared so events are still associated with the correct profile.  Klaviyo figures it out.

:::::UNTIL:::::

If I update a customer email address using the $id field, the email address updates correctly.  HOWEVER, if I then make a call using just $email the event causes a duplicate profile to be created, it does not update the original profile.

Because the behavior of $email only vs $id and $email calls is different AFTER an $email update, I *think* this is a bug.  I cannot find any other examples of duplciate profiles being created except AFTER submitting a change to their email.

 

Has anyone else run into this?  Have you found a solution?

 

 

icon

Best answer by David To 18 August 2021, 20:12

View original

8 replies

Userlevel 7
Badge +61

Hi @cdetdi,

Thank you for sharing this information with the Klaviyo Community.

Correct me if I am wrong, however, your description of events sounds like the scenario described in our documentation “If calls then come in for the same person, but only $email is part of the request, a permanent duplicate profile will get created for the same person.” You mention you are making the call using just the $email field which is causing a duplicate to be created, if this is correct this would be the expected behavior. If I am misunderstanding, perhaps you can provide an example with more detail. If you choose to do so, please ensure to redact any sensitive information from your example like any legitimate email addresses.

Thank you.

Userlevel 2
Badge +6

For background - we submit $id for any API calls but do not submit ID for javascript tracking.  I don’t want internal ID information available on the front end.

Certainly confusing, I will try to break it down more:

For this sentence you quoted:

If calls then come in for the same person, but only $email is part of the request, a permanent duplicate profile will get created for the same person.”

 

The sentence before is:

“If you send some calls with $id only, these profiles will exist without any associated $email. “

 

To me, these sentences together mean that if I create a profile via $id WITHOUT $email the profile will be created with $id but without $email.  Later if I make a call with $email without $id a new profile will be created.  This makes sense to me and I have no problems with that flow.

I’m talking about after a profile is properly created with $id AND $email.  Future calls that have just $email will be associated with the correct profile.  This is as documented in the API and is how my install is working currently.  Works great.

My issue is that this seems to break down if the $email in the profile is updated.  Steps to reproduce

  1. create profile with $id and $email (works)
  2. Run track API call with $email alone to confirm correct profile updated (works)
  3. change email by making API call with $id and new $email (works)
  4. Check on Klaviyo to see that profile has updated with new $email (works)
  5. Run API call with new $email (broken)

I was able to replicate this behavior yesterday but today #5 seems to be working as expected.  I will retest and examine.

 

 

Badge +1

Hello,

 

We use REST interface, and I am looking at https://apidocs.klaviyo.com/reference/api-overview.
1. I could not find any of the above mentioned information? Can someone please point me to the `API Doc`?
2. The `Track` and `Identity` API does not mention `$id` at all, is it a valid field?
3. The `Profiles` API needs a `person_id`. After I create a profile with only ‘$email’ (no ‘$id’)

Userlevel 7
Badge +60

Hello @adaptors.india@ethyca.com,

The above information mentioned by both @cdetdi and @dov.derin, has actually be moved to the Track and Identify API Reference article as the Klaviyo API Documentation was updated recently. 

As part of Klaviyo’s Track and Identify API, $id is a valid field that can be used as a custom unique identifier. However, we do recommend using $email as an identifier key for consistency purposes. As the article calls out:

If you choose to use your own unique identifier with the $id key, you take on the full responsibility of identity management within your Klaviyo account. You must ensure that all calls are made mapping the right $id value you're setting to the right $email. If you send some calls with $id only, these profiles will exist without any associated $email. If calls then come in for the same person, but only $email is part of the request, a permanent duplicate profile will get created for the same person. Given the complexity of ensuring $id and $email are mapped correctly with every call across all data sources, we recommend exclusively using email address to identify individuals.

Note $id should never be used to track profiles anonymously. This will have a high potential of creating multitudes of profiles for individual people on your account if not set up thoughtfully. Only use $id if a given person has a known $email and their associated ID will never change (eg. an account ID in your own system).

 

When using the Profiles API, you can get the PERSON_ID if you know the profile’s email by making a subsequent call of https://a.klaviyo.com/api/v2/people/search?api_key=API_KEY_HERE&email=EMAIL_HERE as detailed in the following Community Post:

Hope this helps!

David

Userlevel 2
Badge +6

David  - 

We’re still struggling with this and I think Klaviyo’s handling of this situation is inconsistent.  In our implementation when we use the API we call both $id and $email.  When we use the Javascript calls we just just the $email.  This is consistent across the system.

Most of the time (90%+) the Javascript calls are matched with the correct profiles.  However, sometimes they are not and a duplicate profile is created.  We’ve tested and tested and when testing behavior works as expected, except that randomly we’re still seeing duplicate profiles.

Note: We are useing the ID field mainly because we found no way in your system to allow $email to be changed/updated for a customer without creating a new profile.  If we submit a call with $id then the $email is secondary and does get updated.  If there is an alternate way to address this please advise.

Userlevel 7
Badge +60

Hey @cdetdi,

Maybe this will help you further understand the expected behavior of using $ID and $Email to identify your contacts:

  • SCENARIO 1: A profile in Klaviyo exists with the $id AND $email set for Betty.
    • If an API request comes in that identifies Betty using her $id only, Klaviyo responds, "Great! This $id matches an existing profile!" and update Betty's existing profile.
  • SCENARIO 2: A profile in Klaviyo exists with the $id AND $email set for Betty.
    • If an API request comes in that identifies Betty using her $email only, Klaviyo responds, "Great! This $email matches an existing profile!" and update Betty's existing profile.
  • SCENARIO 3: A profile in Klaviyo exists with ONLY $id set for Betty (no email address)
    • If an API request comes in that identifies Betty using her $id and $email, Klaviyo responds, "Nice! This $id matches an existing profile!" and update Betty's existing profile including setting the $email.
  • SCENARIO 4: A profile in Klaviyo exists with ONLY $email set for Betty (no $id).
    • If an API request comes in that identifies Betty using her $id and $email, Klaviyo responds, "Nice! This $email matches an existing profile!" and update Betty's existing profile including setting the $id.
  • SCENARIO 5: A profile in Klaviyo exists with the $id AND $email set for Betty.
    • If an API request comes in that identifies Betty using her same $email and a different $id, Klaviyo responds, "Nice! This $email matches an existing profile!" and update Betty's existing profile including updating the $id.
  • SCENARIO 6: A profile in Klaviyo exists with ONLY $id set for Betty (no email address).
    • If an API request comes in that identifies Betty using her $email only, Klaviyo responds, "Uh oh! This $email doesn't match any existing profile!" and create a new profile with that email address.

In all of the scenarios, scenario 6 is the only negative one. This leaves Betty with one profile that just has her $id, and another profile that just has her $email, since there's no way for Klaviyo to know it's actually the same person. This is why we highly discourage customers from ever creating profiles with $id only – not only do you need an email address to really use a profile in Klaviyo, but it also can lead to duplicate profiles getting created in this way. Eventually, an $email may get set on the profile that started out with $id only, but if a profile in the meantime was created with $email only, these 2 profiles will persist as dupes.

Another thing to keep in mind is that duplicate profiles for the same person can get created when there is a Track/Identify call that uses $id as the primary unique identifier, and another call that uses just $email as the unique identifier, and both profiles are being created at the same time. This can happen if, for example, someone subscribes to a form and a "Subscribe to List" call occurs using just $email but also a track event takes place at the same time on server-side using $id

I hope this helps!

David

Userlevel 2
Badge +6

David - thank you for the detailed explanation of the logic.  It matches, 100%, what I’m expecting.

The issue is that, seemingly randomly, this logic isn’t executed as you describe.  It works nearly perfectly.  We’ve done our best to ensure that our code is uniform and we’ve done a few audits to confirm that.  API always declares both $id and $email.  JS always declares $email only.  We always call the API call first, before page load with the JS tracking code.  

How can I dig into this further?  Can I send you the payloads of two similar event histories, one that tracked correctly and one that duplicated?  Perhaps there is something you can see that we cannot.

Userlevel 7
Badge +60

Hey @cdetdi,

Since the Community forum is a place where our customers have the opportunity to connect with one another and share their experiences and solutions, I would suggest working with a developer or finding a Klaviyo Partner who can further audit your APIs and their payload to see if there were any distinguishing features between the payloads that tracked correctly and those that duplicated the profile. 

In addition, I may also suggest reaching out to support to hear their feedback and continue troubleshooting this specific issue with you. 

Have a great day!

David

Reply