Can we get duration column in mixpanel tables
Hi Ankit S., 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
Yes, Mixpanel provides several ways to capture and analyze duration data in your reports: 1. Automatic Duration Property: When you use timing events in Mixpanel, a $duration
property is automatically appended to your events to capture the elapsed time in seconds between a timeEvent
call and a subsequent track
call. This is available across all SDKs (JavaScript, Android, iOS, Unity, etc.) Default Properties.2. Session Duration: For session analysis, Mixpanel automatically creates a "Session Duration (Seconds)" property ($duration_s
) which measures the time between Session Start and Session End events Reserved Properties.3. Manual Timing Implementation: You can implement timing in your tracking code using the SDK-specific methods:
- JavaScript: mixpanel.time_event()
and then mixpanel.track()
- iOS (Swift): Mixpanel.mainInstance().time(event:)
and then Mixpanel.mainInstance().track(event:)
- Android: mixpanel.timeEvent()
and then mixpanel.track()
- React Native: mixpanel.timeEvent()
and then mixpanel.track()
- Flutter: mixpanel.timeEvent()
and then mixpanel.track()
- Unity: Mixpanel.StartTimedEvent()
and then Mixpanel.Track()
For example, in Swift: ```// start the timer for the event "Image Upload"
Mixpanel.mainInstance().time(event: "Image Upload")
// 20 seconds later...
// track "Image Upload" event with "Duration" event prop set to 20 Mixpanel.mainInstance().track(event: "Image Upload")```You can then use this duration data in various reports like Insights to analyze metrics such as average session length per user or session duration broken down across users Session Controls in Reports.
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.