Mixpanel Community Icon

Accurately Tracking Session-Level Referrer Data in Mixpanel

·
·

Capturing accurate session-level referrer data in Timeout-Based Sessions Hi guys, I'm facing a challenge with tracking the referral source in timeout-based sessions within Mixpanel — need your help. The issue is as follows: Overwriting Session Properties:

  • If a $referrer is present before the session start event in certain user I’m querying, that value ends up being overwritten on the later Session Start event. I’d prefer that if a $referrer is absent, it remains absent—accurately showing when there's no referrer by code.

Referral Tracking Logic:

  • I do use UTM parameters for sure, but they can easily break when the users' referral happens. That's why I’m building my referral logic to also refer "$referrer". Even when $referrer is absent, that absence carries much more important information for the logic than overwritten one.

What I tried or considered: Custom Property Workaround Attempt:

  • I tried to address this by using a custom property that outputs a string (like "-") when $referrer is missing to stop session events referring past properties. Unfortunately, custom properties can’t be applied to session events, which limits my options.

Reluctance to Switch Session Types:

  • Switching from timeout-based sessions to event-based sessions isn’t ideal either, as it would make it impossible to analyze historical data. I’d like to stick with timeout-based sessions if possible.

Does anyone have advice or best practices for capturing session-level referrer data that accurately reflects when $referrer is missing or present, without the value being overwritten on the last Session Start event? Thanks in advance for any insights or workarounds!