I’m working on a custom integration for our app, where we would want to query klaviyo to get a profile ID from the cookie or session somehow. Meaning, what I’m trying to do is be able to retrieve a profile ID from the cookie or something so i can map it back to a call for the full profile etc.
Is this somehow possible? Can’t seem to find the api docs or guide on how we would be able to identify a klaviyo profile/tracked user on the merchant site while the site is loading/page loaded etc.
Solved
Accessing Cookie or Identifying Tracked User
Best answer by saulblum
The __kla_id cookie is a base64-encoded JSON block. If there’s an identified profile, there will be a property such as:
"$exchange_id":"bIgfUuOCPJUzy9lKtTkDmnAS8EE6u0FxfWDk07E-sAytXAgIwM3cG9F216V5Gvmn.PGuJQv"
You can use this value in a filter in Get Profiles in a server-side call:
https://developers.klaviyo.com/en/reference/get_profiles
This would give you the profile ID.
No PII is exposed in the cookie itself, so you’d have to make this server-side API call.
Reply
Rich Text Editor, editor1
Editor toolbars
Press ALT 0 for help
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.