Retention report. I'm trying to show a breakdown of signup rate by 'refer' property. The thing is, I only care about the 'refer' property for the first event. If I use 'breakdown' it says the rate is 0% for every referral source because by the time they sign up refer is mysite.com
Hi Philip, 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
You can do this in Retention by: 1. Make sure refer is captured on the event (e.g. page view / first touch) as an event property, or as an “initial referrer” style property. Mixpanel’s JS SDK already does this for $initial_referrer / $initial_referring_domain and UTM params. [Web attribution]2. In your Retention report, keep your behavior as:
- First event: e.g. Sign Up Completed
- Return event: whatever you’re measuring (or Any Event) [Retention quick start]3. Use Breakdown on the first-touch property instead of the current refer that’s overwritten at signup:
- If you’re using Mixpanel’s defaults, break down by $initial_referrer or $initial_referring_domain (or by initial UTM properties like utm_source, utm_campaign, etc.). [Web attribution; Breakdowns overview]Because those “initial” properties are fixed at the first visit, the breakdown will reflect the original referral source, not the later refer value that becomes [mysite.com](http://mysite.com), and your retention / signup rate per source will no longer show 0% for every segment.
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.
Let me check the knowledge base for you again. One moment! 📚
Since you’re not using the JS SDK, Mixpanel will not automatically store “first-touch” referrer/UTM info for you; you need to send and persist it yourself on the server side.Here’s the pattern you want: 1. On the very first request from a user
- Parse the referrer and UTMs from the incoming request (headers + URL). [Server-side attribution]
- Store these values somewhere tied to that user/device (your own DB, session, or cookie) as “initial” properties, e.g. initial_refer, initial_utm_source, etc.
- When you send any Mixpanel event, include those “initial” properties as event properties. Example from the docs (you’d extend this to also store the values your side):
from mixpanel import MixpanelLBKS mp = mixpanel.init("YOUR_TOKEN")LBKS def track_to_mp(request, event_name, properties):
if "Referer" in request.headers:
properties.update({
"$referrer": request.headers["Referer"],
"$referring_domain": urlparse(request.headers["Referer"]).hostname,
})LBKS 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)LBKS properties["ip"] = request.remote_addr
mp.track(request.user_id, event_name, properties)
[Server-side best practices; Server-side attribution]2. On the signup event
- Do not rely on the current refer (which is now your own domain).
- Instead, include the stored “initial” property (e.g. initial_refer) on the signup event.3. In the Retention (or Funnels/Insights) report
- Break down by that “initial” property (initial_refer), not by the live refer that always becomes [mysite.com](http://mysite.com).This mirrors what the JS SDK does automatically with $initial_referrer and initial_utm_*; you’re just implementing the same logic server-side so that your breakdown uses the first-touch source rather than the latest referrer. [Web attribution]
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.
