Skip to main content
Contributor I
May 24, 2023
Solved

Track same user for two domains with new klaviyo object

  • May 24, 2023
  • 3 replies
  • 490 views

How to track same user for two domains with new klaviyo library.

    This topic has been closed for replies.
    Best answer by Brian Turcotte

    ​Hi @web!

     

    The task you’re describing can be challenging - but I can definitely provide some resources and direction. Also - I would keep in mind that this constitutes a custom use case, so there is only so much guidance that Community and/or Support can offer.

     

    For starters, this Community thread gives a pretty good idea of the how to accomplish this:

     

    You will essentially have to grab the exchange ID from the cookie in the first domain, then use the following API endpoint to exchange that for the Profile ID, which you can use to identify the profile on the next domain:

     

    The exchange ID is stored within the cookie, and you can test this behavior by following these steps (after cookie-ing yourself):

    • in chrome, right click > inspect
    • locate the network tab in the window that just opened
    • look for the "track" network call in the list and click "payload" and find the one that has _activity__  in it

    It will look something like this:


    You can retrieve and decode the cookie programmatically by implementing the solution from the aforementioned community post, specifically this script:

    _learnq.push(["_getIdentifiers"]).$exchange_id

     

    Since this can warrant extensive custom development, you’re always welcome to reach out to one of our wonderful Official Klaviyo Partners for further help.

     

    I hope this helps to get you started, and thanks for using the Community!

    - Brian

    3 replies

    Brian Turcotte
    Klaviyo Alum
    May 25, 2023

    Hi @web!

     

    Let me check on this for you with Engineering, and I will update the thread as soon as possible!

     

    Best,

    Brian

     

    webAuthor
    Contributor I
    May 29, 2023

    Hi @Brian Turcotte 

    Did you check the above query with Engineering?

    Brian Turcotte
    Klaviyo Alum
    May 31, 2023

    ​Hi @web!

     

    The task you’re describing can be challenging - but I can definitely provide some resources and direction. Also - I would keep in mind that this constitutes a custom use case, so there is only so much guidance that Community and/or Support can offer.

     

    For starters, this Community thread gives a pretty good idea of the how to accomplish this:

     

    You will essentially have to grab the exchange ID from the cookie in the first domain, then use the following API endpoint to exchange that for the Profile ID, which you can use to identify the profile on the next domain:

     

    The exchange ID is stored within the cookie, and you can test this behavior by following these steps (after cookie-ing yourself):

    • in chrome, right click > inspect
    • locate the network tab in the window that just opened
    • look for the "track" network call in the list and click "payload" and find the one that has _activity__  in it

    It will look something like this:


    You can retrieve and decode the cookie programmatically by implementing the solution from the aforementioned community post, specifically this script:

    _learnq.push(["_getIdentifiers"]).$exchange_id

     

    Since this can warrant extensive custom development, you’re always welcome to reach out to one of our wonderful Official Klaviyo Partners for further help.

     

    I hope this helps to get you started, and thanks for using the Community!

    - Brian