I have configured Auto captured events on my website and I have an expectation that the user profile would sync when the user visits my another domain as I have set up cross domain tracking. But I have noticed {Auto} page view event is not capturing countries and other UTM variables, what is a way around so that I do not miss the tracking?
Hi Akif A., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> 👋
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
Autocapture will fire [Auto] Page View events, but for them to have correct country and UTM data across domains you need to make sure of two things: 1. Geolocation (country/region/city) for autocapture events By default, Mixpanel infers geolocation from the IP address of the request. If events are sent from your server, or via a proxy/CDP, they will inherit the server’s IP, so all countries may look the same. [Default properties; Geolocation overview] Workarounds:
- Pass the real client IP into the payload using $ip, so Mixpanel parses the correct location; or
- Explicitly set $city, $region, mp_country_code (events) or $country_code (profiles), or
- Set $latitude/$longitude to let Mixpanel reverse‑geocode a precise location. [Manual geolocation; FAQ: same location] If you’re going through a proxy, ensure it forwards the client IP and doesn’t mask it with the proxy/server IP.2. UTM & referrer on autocapture events across domains On web, the JS SDK normally:
- Reads UTM params and referrer on page load
- Persists them as super properties and as initial_utm_** profile properties for first‑touch / last‑touch attribution. [FAQ: first/last touch UTMs; Traffic attribution – web vs server] But if you:
- Are tracking server‑side, or
- Are sending events via a proxy/CDP, or
- Don’t have the UTMs/referrer available on the client, then you must *manually attach UTM and referrer properties to events. For server‑side implementations Mixpanel recommends parsing Referer and query params and adding them to properties before track(). [Server-side UTMs example; Server-side attribution code] Example pattern (server‑side):
if "Referer" in request.headers:
properties.update({
"$referrer": request.headers["Referer"],
"$referring_domain": urlparse(request.headers["Referer"]).hostname,
})
utm_keys = ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"] utm_values = {key: request.args[key] for key in utm_keys if request.args.get(key)} properties.update(utm_values) properties["ip"] = request.remote_addr mp.track(request.user_id, event_name, properties)
``` This same approach applies if you’re enriching autocapture events via a backend: pull referrer/UTMs from the original request and add them before forwarding to Mixpanel.---**In practice for your setup (autocapture + cross‑domain):**- Ensure your JS SDK is initialized on each domain with autocapture enabled ({ autocapture: true }). [Autocapture intro]
- Keep cross‑domain identity working by passing distinct_id between domains and calling identify() on the second domain, as per the cross‑domain FAQ. [Cross-domain tracking]
- If events go through any server/CDP/proxy, enrich them:
- Set $ip (or explicit geo properties) so country is correct.
- Parse and attach utm_*, $referrer, $referring_domain.If after this [Auto] Page View is still missing geo/UTMs on a specific domain, that likely means those properties are being stripped or replaced (e.g., proxy overwriting IP or not forwarding query headers), and you’ll need to adjust that layer accordingly.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
Ansh A. facing 2 main issues.
Users coming in from PPC on my website - I trigger auto capture event for page view - but i do not see country variable in it - it says (not set) - but for others it is tracking.
Second issue is, when a user clicks on any of the CTA on my web and is directed to my another domain that is the product, an entirely new profile is created for them - all his website events are being tracked on another profile and whatever action he performs on the product domain, they are being tracked on another profile. Ideally they should be synced into 1 profile.
Its a sub domain, if we even exclude ppc, does {Auto Captured} page view event automatically tracks the country?
Yes, it should automatically track the country. What have you done for sub domain tracking? What does your init call look like?
Backend: mp = Mixpanel(MIXPANEL_TOKEN) Frontend: mixpanel.init(analyticsConfig.mixpanel.id, {debug: false}); This is what we added.
Got it. in mixpanel.init have you added the subdomain clause and set it to true? mixpanel.init('YOUR_PROJECT_TOKEN', { 'cross_subdomain_cookie': true });
Try this out.
Ansh A. We are experiencing an issue related to cross-domain identity resolution. Currently, we pass the anonymous Distinct ID from our website (Domain 1) to our web application (Domain 2). When the user signs up, this anonymous Distinct ID from the website is bound to the User ID using Mixpanel's simplified ID merge. Consequently, the events tracked from the website (Domain 1) are correctly attributed to the User ID. The core issue is that this binding process is permanent and manual, leading to data attribution errors for repeat sign-ups. Due to this ID merge, if the same individual revisits the website (Domain 1), is redirected to the app (Domain 2), and signs up as a new user (creating a second User ID), the website events tracked during this new session remain permanently bound to the first User ID this individual signed up with. As a result, all subsequent sign-ups that originate from a redirection from the website incorrectly merge their anonymous website events into the first user's Mixpanel event history.
