How to track users across multiple subdomains?

Kamil Drazkiewicz
Kamil Drazkiewicz1 minMay 11, 2022

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' })

Related articles

    Start understanding
    your users today

    Free 14-day trial

    No credit card required

    Easy setup