How to track same user on subdomain?

Badge +1
  • Contributor I
  • 4 replies


I have two domains for example: and
I want to track same user for both domains. I mean if user A push event on domain and same user push event from other domain, then how klaviyo cookie automatically track the same user for second domain? It will not create other profile for other domain only one profile can track both domain.

I read below link but new klaviyo object is not giving the exchange_id. 



Best answer by Brian Turcotte 31 May 2023, 19:45

View original

6 replies

Userlevel 7
Badge +60

Hi @web


Welcome to the Community, happy to help! 


Great work so far! While it was previously allowed to track users across different domains by using _ke parameter , this was changed last year to increase security protection. Now we have switched to using an exchange id, or _kx  parameter. So you will need to go about tracking the user in a different way, which is append the exchange id value to each link on one subdomain that then directs to the other, instead of the previous used code below. But Dov shared two great ways to still find the user to have seamless tracking across both domains!



Do you mean that you tried both methods, mentioned in the post you linked above, to find the exchange ID and weren’t successful?

  • Decoding the klaviyo cookie and retrieving it
  • Expose in our frontend library called _learnq.push(["_getIdentifiers"])  which should return a key value pair in an object with $exchange_id so long as the user is cookied.


If you followed the second option, did you ensure to the script ends in the _kx parameter instead of the _ke parameter? If should look like the code below:

+ '_kx=' + exchange_id)
}, 1200);


Thanks for participating in the Community!


Badge +1

Hi @Taylor Tarpley

I am using new object klaviyo instead of legacy _learnq object. 

I used new object “klaviyo.push(["_getIdentifiers"])” for getting $exchange_id , but it is giving the error i.e. “Unable to process event: _getIdentifiers”.

How we get $exchange_id  with new object klaviyo?
Is there any other way to track the same user for subdomain?

Userlevel 7
Badge +60

Hey @web,

Can you confirm if the user was identified/cookied on the first domain before attempting to retrieve the $exchange_id?

I’m not a developer, but that error you’re getting of “Unable to process event: _getIdentifiers” seems to indicate that it was unable to process/retrieve the identifier originally. 


Badge +1

Hi @David To,

yes, I am identified/cookied the user on the first domain before attempting to retrieve the  $exchange_id.

Also i have one more question, If we cookied the user on one system, then how we get that user on the other system for second domain?

Badge +1

Hi @David To,

Below code is not working in react. What is the ‘a’ element? 

if setting the exchange_id overwrites the values from a _kx parameter? 


Userlevel 7
Badge +36

Hi @web!

I see that you also asked this question in another Community thread in the Developer Group, so for the sake of organization and visibility, I’m going to link to that here: