questions about duration property
Hi Seungwon 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
kapa.ai 1. Definition of the Duration Metric
Question: What is the definition of the "Duration" function in a Mixpanel Insights report?
Key Point: You wanted to understand how Mixpanel calculates the time spent and what this metric represents in a standard report.
2. Duration in the Context of Page View Events
Question: What specifically does "Duration" mean when applied to a Page View event?
Key Point: You were clarifying if this refers to "Time on Page" and how the SDK tracks the start and end points for a specific URL or screen.
3. Clarifying "Next Event" for Calculation
Question: Does the "Next Event" used to calculate duration have to be at the exact same time?
Key Point: You were questioning the mathematical logic—whether the duration is a point in time or a span between two different timestamps.
4. Clarifying Event Types for Calculation
Question: Does the "Next Event" have to be the same type of event (e.g., another Page View) to trigger the duration calculation?
Key Point: You were confirming if Mixpanel only measures the gap between two identical events or if any subsequent user action (like a click or scroll) completes the duration measurement for the previous event.
Please stand by Seungwon C. as I search the knowledge base. I normally take about 15 seconds or so. 👋
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
Here’s what the knowledge sources say about “duration” in Mixpanel: 1. Event “Duration” (timed events from SDKs)
- When you use the timing APIs in the SDKs (e.g. time_event / timeEvent / .time(event:) / StartTimedEvent), Mixpanel automatically adds a numeric event property called Duration (display name “Duration”).
- It is the elapsed time in seconds between starting the timer and the subsequent track call. [Default props]
- Examples:
- JavaScript: mixpanel.time_event('Image Upload'); … mixpanel.track('Image Upload'); [JS SDK]
- Android: mixpanel.timeEvent("Image Upload"); … mixpanel.track("Image Upload"); [Android SDK]
- iOS Swift: time(event:) then track(event:) [Swift SDK]
- iOS Obj‑C: timeEvent: then track: [iOS Obj‑C]
- React Native / Flutter / Unity have equivalent timing methods that also populate Duration. [React Native; Flutter; Unity]2. Session Duration (Seconds) – $duration_s
- For Session Start/End events, Mixpanel computes a reserved property $duration_s (display name Session Duration (Seconds)).
- It is the time in seconds between the Session Start and Session End events. [Reserved props; Session properties]
- You can use it directly in reports (e.g. average session duration, or convert to minutes with a formula dividing by 60). [Sessions FAQ]3. Computed “Duration” (between two instances of an event)
- As a Computed Property, “Duration” can also mean: “the duration between 2 instances of an event” (e.g. between two Page View events).
- This is not stored on events; Mixpanel calculates it at query time as a virtual property. [Computed properties]If you have a more specific question (e.g. how to chart it, bucket it, or convert units), share your use case and I can narrow this down.
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.
Based on the provided documentation, here are the answers to your questions regarding the Duration metric and function in Mixpanel:
1. Definition of the Duration Metric
In Mixpanel, "Duration" can refer to two distinct things depending on the context of the report:
** Computed Duration Property: This is a behavioral property that returns the duration between two instances of an event. It is calculated dynamically at query time using existing data in your dataset [Computed Properties].
** Session Duration ($duration_s): In the context of Session Start/End events, this represents the total time between the first and last events of a user's session [Reserved Event Properties; Session Properties].
** *Timed Events ($duration): If you use the .timeEvent() SDK method, the "Duration" property captures the elapsed time (in seconds) specifically between that "start" call and the subsequent .track() call for that same event name [Android SDK; Default Properties].
2. Duration in the Context of Page View Events
When applied to a Page View event as a computed property, "Duration" functions as a measure of the time elapsed between one Page View and the next. This effectively measures Time on Page. It works best for events that occur continuously during a session, like Page Views or Screen Views, to estimate how long a user stayed on a specific screen before moving to another one [Computed Properties].
3. Clarifying "Next Event" for Calculation
The duration is a span between two different timestamps, not a single point in time. It is calculated as the mathematical difference (usually in seconds) between the timestamp of the first event and the timestamp of the "Next Event" [Session Properties; Default Properties]. If no subsequent event is found, the user is often categorized in a "Did not convert" segment for that calculation [Computed Properties].
4. Clarifying Event Types for Calculation
For the Duration computed property, Mixpanel calculates the time between two instances of the same event. For example, if you are measuring the duration of a Page View, it measures the time until the next Page View occurs [Computed Properties]. In contrast, Session Duration measures the time between the "Session Start" and "Session End" regardless of the specific event types in between, as long as they are not explicitly excluded from session calculations [Session Properties; FAQ].
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 in computed properties, the next page view means the same event follwing?
Let me check the knowledge base for you again. One moment! 📚
I’m sorry, but the knowledge sources do not explicitly define what “next Page View” refers to inside the Duration computed property beyond this short description: > “The duration property returns the duration between 2 instances of an event. This works best for events that occur continuously during a session such as Page View or Screen View.” [Computed props]From this wording alone, all we can safely say is: - Duration is calculated between two instances of the same event (e.g. Page View → Page View). [Computed props] - The docs do not clearly specify whether “next” means strictly the immediately following occurrence of that same event, or whether any later matching event could be used.Because the documentation doesn’t go deeper into the matching logic, I can’t confidently confirm more detail than that.
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.
