We are seeing an issue where duplicate profiles are being created by Klaviyo JS.
On our site, when a user changes their email address;
- On each page load, we send over an Identify call with the user’s email address
- The form is posted to our server with a full page refresh
- The server will then send an API request to Klaviyo (https://a.klaviyo.com/api/profile-import) which will upsert the profile with the new email address.
- The page loads and Klaviyo instantly sends over an “Active on Site” event using the cached _ks parameter which is linked to the old email address. The profile’s email address in Klaviyo has already been updated via the API call, so Klaviyo thinks that this is a new user and created a duplicate account.
- A few milliseconds later, the Identify call is made with the updated email address and Klaviyo starts tracking the correct
I believe this is the same issue which was experienced in this, and we’ve tried deleting Klaviyo JS’s _ks cookie on the edit profile page. This has fixed the aforementioned scenario for our testing, however, it seems some users are still experiencing it and we’re seeing duplicate accounts and 409 errors in our logs.
I was wondering if anyone else has experienced this?
Does anyone know if there is a way to get Klaviyo’s JS to wait for the Identify call before sending an Active on Site event?