Track Users Across Domains

Mixpanel can track events across domains and hosted subdomains

Tracking your users across multiple domains is possible with Mixpanel if you:

  • Ensure data from the sites are going to the same project: In other words, initialize the Mixpanel library using the same project token on all sites.

  • Keep the user’s identity consistent across sites: Mixpanel uses a unique identifier called distinct_id to differentiate one user from another. The distinct_id lives in the cookie, but since the user’s cookie changes as they move from one site to another, you’ll need to pass the distinct_id from the first site to the second.

Steps to pass distinct_id between sites

  1. Grab the distinct_id of a user from the first domain by using mixpanel.get_distinct_id() in the loaded callback.

  2. Pass the user’s distinct_id from the first site to the second via a URL parameter (Not sure how? Here’s more information on adding properties into the URL). You can also pass properties assigned to a user from the first site to the second via the URL parameter.

  3. When the user lands on the second site, call mixpanel.identify(distinct_id) before making any other Mixpanel calls.

Is this article helpful?
4 out of 5 found this helpful

Comments

0 comments

Article is closed for comments.