Fixing Mixpanel Subdomain Tracking with Google Tag Manager
Greetings, friends! I just integrated Mixpanel into terraformation.com using Google Tag Manager, and it was really easy. Thanks for making this such a simple setup! For terraformation.com/plant , we use a subdomain plant.terraformation.com to host an iframe containing payment UX. I noticed Mixpanel + Google Tag Manager was sending different Distinct IDs for the outside (parent) HTML and the inner (iframe) HTML, even though the documentation says that subdomain tracking should work by default. I tracked this behavior down to https://github.com/mixpanel/mixpanel-gtm-template/pull/18 which landed in September, It changed the default persistence to localStorage for Google Tag Manager users. This breaks subdomain tracking, which really surprised me. Explicitly changing persistence back to cookie solved the problem for me.
