Solved

Accessing Cookie or Identifying Tracked User

  • 17 April 2024
  • 1 reply
  • 20 views

Badge

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. 

icon

Best answer by saulblum 17 April 2024, 13:47

View original

1 reply

Userlevel 4
Badge +7

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