Skip to main content
Contributor II
October 19, 2021
Solved

Tracking events across sub-domains

  • October 19, 2021
  • 5 replies
  • 891 views

I have shop with checkout happening on separate sub domain, it seems like Klaviyo tracks only on domain user was created.

 

example:

a.com (Klaviyo form)

check.a.com

 

Here all activities of a.com are tracked for a user created via Klaviyo form; while when user moves to  check.a.com - nothing is tracked.

    This topic has been closed for replies.
    Best answer by stephen.trumble

    Hey @alenjose 

    Great question to ask the Klaviyo Community for help with! There have been a few people who have had the same question as you. Hope I can help you start that process to solve this challenge.

    When your check out is hosted on a different subdomain, it requires a custom code that allows the Klaviyo cookie to be tracked across your subdomains. @Dov  responded to this same question on this community post with the custom code and where it needs to go on your site: 

    Please give this a thorough read through as it should fix your challenge. We are always here for you if you in the Klaviyo Community if you find yourself with more questions or challenges!

    5 replies

    stephen.trumble
    Klaviyo Alum
    October 19, 2021

    Hey @alenjose 

    Great question to ask the Klaviyo Community for help with! There have been a few people who have had the same question as you. Hope I can help you start that process to solve this challenge.

    When your check out is hosted on a different subdomain, it requires a custom code that allows the Klaviyo cookie to be tracked across your subdomains. @Dov  responded to this same question on this community post with the custom code and where it needs to go on your site: 

    Please give this a thorough read through as it should fix your challenge. We are always here for you if you in the Klaviyo Community if you find yourself with more questions or challenges!

    -Stephen
    alenjoseAuthor
    Contributor II
    October 22, 2021

    Thank you

    alenjoseAuthor
    Contributor II
    October 22, 2021

    @stephen.trumble  I couldn’t fully test this as to counter the issue we actually designed flow to get user land on checkout sub-domain to get  cookie. 

     

    But even with this script I don’t see the cookie’s domain with dot. 

    Example if I am my site is https://abc.com

     __kla_id   cookie is always set for abc.com  while it should be .abc.com  to work well in all sub-domains.  is there any script modifications to do this? 

    alenjoseAuthor
    Contributor II
    November 5, 2021

    @stephen.trumble  do you have any other solution?  Looks like overall most flows are broken for us in production. I tried above script too but its not working. Is there any manual way of assigning cookie ids?

     

    Our flow got 3 applications - 2 WordPress and 1 Odoo

    stephen.trumble
    Klaviyo Alum
    November 5, 2021

    @stephen.trumble  do you have any other solution?  Looks like overall most flows are broken for us in production. I tried above script too but its not working. Is there any manual way of assigning cookie ids?

     

    Our flow got 3 applications - 2 WordPress and 1 Odoo

    Hey @alenjose 

    Unfortunately if the workarounds that were already shared haven’t worked, I do not know of any other workaround other than having an account for each subdomain. So, within your Klaviyo account you are only able to have one subdomain connected. While you can use different sender email addresses in the various messages, at this time multiple subdomains are not supported.  I understand that this might not be an ideal response, but setting up an account for each would be the quickest resolution currently. If you are the owner of the accounts, you can work with the Klaviyo Support team to clone templates, flows and campaigns to the new accounts so you do not have to painstakingly reproduce your content.

    -Stephen