All Collections
Tracking code
Tracking users across multiple subdomains
Tracking users across multiple subdomains
Kamil avatar
Written by Kamil
Updated over a week ago

Let’s say you install a script on domains example.com and blog.example.com. When the user goes from one domain to another, it will be registered as two separate sessions under two different IDs.

In this situation, LiveSession sees the same person as two separate users. Here’s how you can solve this issue:

To track users across multiple subdomains, you have to set a rootHostname option to your top-level domain (eg. .your-domain.com) when calling the __ls("init") method. Please note that the first character in .your-domain.com is a dot.

Example:

Your main domain is mywebsite.com but you also want to record on blog.mywebsite.com :

__ls("init", "YOUR_TRACK_ID", { rootHostname: '.mywebsite.com' })
Did this answer your question?