mixpanel-js icon indicating copy to clipboard operation
mixpanel-js copied to clipboard

Cross-subdomain tracking does not seem to be working

Open erlloyd opened this issue 6 years ago • 5 comments

We have mixpanel (latest version 2.27.0) loading on some subdomains for our site via google tag manager from the CDN. We also load mixpanel (built and deployed via an angular 7 SPA) on our main site. Today we noticed that visitors to the subdomains who continue on to our primary site are not having their actions connected together (the distict_id values for actions on the subdomain and primary domain site are not connected)

This appeared to work yesterday (March 7), but stopped working today. I'm concerned the 2.27.0 release caused this problem, especially since there was a change to the subdomain cookie code.

The way I can tell this is a problem: If I visit 'subdomain.ourdomain.com', I see a mixpanel cookie created with domain '.subdomain.ourdomain.com'. I expect to see '.ourdomain.com' for the cookie's domain.

If I go directly to our site (www.ourdomain.com) which is using an older version of the mixpanel-browser library (2.21.0) I see a '.ourdomain.com' cookie created as expected.

Please let me know if there is any additional information I can provide, as this is a critical issue to fix for my team. Thank you.

erlloyd avatar Mar 08 '19 22:03 erlloyd

Thanks for the report. You're right, the domain-matching regex is now too greedy. We're going to revert the change for now while fixing. Will post back here when the revert is out. Apologies for the trouble.

tdumitrescu avatar Mar 08 '19 23:03 tdumitrescu

Thanks for looking into it right away, and thanks for the quick response!

erlloyd avatar Mar 08 '19 23:03 erlloyd

Sorry, GitHub auto-closed this from a private "fixes" comment. The change has been reverted with https://github.com/mixpanel/mixpanel-js/commit/9e8084060c5c34c3815c5635822c63f42ccefc5f and published in v2.27.1. For safety, we'll post here when the fixed version goes out.

tdumitrescu avatar Mar 08 '19 23:03 tdumitrescu

Thanks again. I can confirm the revert has fixed our issue.

erlloyd avatar Mar 09 '19 00:03 erlloyd

I actually want the functionality where I do not want to track users across subdomain. Only need to set the cookie on my particular subdomain, is it possible ?

gaurav5430 avatar Aug 05 '21 17:08 gaurav5430