for timeout-based sessions, if $referrer only appears in a later event (like oAuth), does it retroactively become the Session Start's $referrer? This makes it hard to analyze the original entry point. Any advice?
Hi Eliott C., 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
Based on the knowledge sources provided, I can answer your question about timeout-based sessions and the behavior of the referrer property does not retroactively become the Session Start's referrer property only appears in a later event like oAuth, it will not be retroactively applied to the Session Start event. The Session Start event will retain the properties from the first event in the session where those properties were defined.To analyze the original entry point, you might want to consider using the initial_referring_domain properties instead. These properties are tracked by Mixpanel's Javascript library and are set based on the user's first visit. As stated in the Traffic Attribution documentation: "Mixpanel's Javascript library will track Initial Referrer and Initial Referring Domain and append them as a property to any event that a user completes. These properties are stored in the Mixpanel cookie the first time a user comes to your site and will not change on future site visits as long as the cookie is not cleared."Using these initial referrer properties can help you analyze the original entry point more accurately, as they persist across sessions and are not affected by later events in a timeout-based session.To improve your analysis of entry points, you could: 1. Focus on the initial_referring_domain properties for understanding the original source of traffic. 2. Use custom properties to track specific entry points if needed. 3. Consider using event-based sessions if you have clearly defined events that denote the beginning of a session in your application.Remember that you can customize which properties are associated with sessions in your Project Settings under Session Settings, which might help you tailor the session data to your specific analysis needs.
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.
kapa.ai How can I track the referral source for a specific session rather than just the initial visit? Since $initial_referrer only captures the very first referral and custom properties can’t be applied to session events, what alternatives or best practices does Mixpanel offer for capturing session-level referral data?
Let me check the knowledge base for you again. One moment! 📚
To track the referral source for a specific session rather than just the initial visit, Mixpanel offers several approaches. Here are some alternatives and best practices based on the available knowledge sources: 1. Use the $referrer and $referring_domain properties: Unlike $initial_referrer, these properties capture the referring URL and domain for each event. As mentioned in the [Default Properties documentation](https://docs.mixpanel.com/docs/data-structure/property-reference/default-properties#event-properties-1): "$referrer: Referring URL including your own domain. Might not be present if document.referrer does not return a value. As opposed to $initial_referrer and $initial_referring_domain, this property will be omitted if the user lands directly or the referring website adds the rel="noreferrer" parameter." 2. Associate custom properties with session events: While you mentioned that custom properties can't be applied to session events, the [Sessions documentation](https://docs.mixpanel.com/docs/features/sessions#session-properties) actually states: "You can add additional properties to be associated with the session by going under Project Settings to Session Settings and selecting the list of properties you wish to be associated with. They will then be accessible for analysis in Mixpanel reports. Note that there is a limit of 4 additional properties that can be associated with session analysis." This means you can add a custom property for referral source and associate it with session events. 3. Track UTM parameters: Mixpanel automatically tracks UTM parameters, which can be useful for understanding the source of traffic for each session. The [Javascript SDK documentation](https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#track-utm-tags) states: "The JavaScript library will automatically add the following UTM parameters present on the page to events fired from that page load: utm_source, utm_campaign, utm_medium, utm_term, utm_content, utm_id, utm_source_platform, utm_campaign_id, utm_creative_format, utm_marketing_tactic" 4. Implement server-side tracking: If you're using server-side tracking, you can manually extract and send referrer information with each event. The [Server-Side Attribution documentation](https://docs.mixpanel.com/docs/tracking-best-practices/traffic-attribution#server-side-attribution) provides an example of how to do this:
python
if "Referer" in request.headers:
properties.update({
"$referrer": request.headers["Referer"]
"$referring_domain": urlparse(request.headers["Referer"]).hostname
})
5. Use event-based sessions: If your use case allows, consider using event-based sessions instead of timeout-based sessions. This would give you more control over when sessions start and end, potentially making it easier to associate referral data with specific sessions.
Best practices: - Consistently track referrer information for all relevant events in your application. - Use a combination of referring_domain, and UTM parameters to get a comprehensive view of traffic sources. - If using server-side tracking, ensure you're passing referrer information with each event. - Customize your session settings to include the most relevant properties for your analysis needs.By implementing these approaches, you should be able to capture and analyze session-level referral data more effectively in Mixpanel.
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.
"You can add additional properties to be associated with the session by going under Project Settings to Session Settings and selecting the list of properties you wish to be associated with. They will then be accessible for analysis in Mixpanel reports. Note that there is a limit of 4 additional properties that can be associated with session analysis."
It is about "Session Properties", not "Custom Properties" availability for session properties. kapa.ai
Let me check the knowledge base for you again. One moment! 📚
You're absolutely correct, and I apologize for the confusion in my previous response. Thank you for pointing this out. Let me clarify the distinction between Session Properties and Custom Properties in Mixpanel, based on the information from the knowledge sources.You are right that the quote refers specifically to Session Properties, not Custom Properties. According to the Sessions documentation: "Mixpanel will also associate properties from the events that are part of a user's session onto the Session events. For Timeout-based sessions, the properties available on the "Session Start" and "Session End" events will be attributed to the first event in which the property is defined of the qualifying sessions."The documentation further states that you can add up to 4 additional properties to be associated with sessions by configuring them in the Project Settings under Session Settings. These properties are then accessible for analysis in Mixpanel reports.It's important to note that these are not custom properties in the traditional sense, but rather existing properties from events that you choose to associate with sessions.For tracking session-level referral data, you could potentially use this feature to associate relevant properties like referring_domain with your sessions, assuming they are not already included in the default list of associated properties.The default list of properties associated with sessions includes: - app_version_string - city - current_url - manufacturer - region - mp_country_code - mp_lib - mp_platform - utm_campaign - utm_content - utm_sourceThank you for bringing this to my attention. It's an important distinction that affects how you can analyze session-level data in Mixpanel.
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.