We often need to analyze how much time a certain action lasts, or how much time passed between two events. We will explain how to track this information in Mixpanel with two different approaches.
In order to track any type of duration in Mixpanel, you will always need to define two time marks: one indicating when a certain action starts, and another one indicating when it ends.
As an example, our case scenario is an online academy, that triggers the events "Lesson start" and "Lesson end" to track how much time each lesson takes.
Option 1: Use "Time to Convert" in Funnels.
You can build a Funnels report where "Lesson Start" is step #1, and "Lesson End" is step #2.
How much time went by between one event and the other will appear in the report as "Time to convert". The default visualization "Funnel steps" will show this metric right under the "clock icon" at the bottom part of the report:
The report above could be interpreted as "From the 357 users who started a lesson, 266 finished it in an average of 8,2 hours".
You could also select the "Time to convert" visualization of the Funnels report. This will show a distribution of the time users need to trigger the second step of the report.
The report above can be understood as "99,62% of the users who finished a lesson, did it faster than 2 days".
Notice that you can customize the "Time Span" intervals by clicking on "Interval Size" at the top of the report:
To learn more about Funnels check this article.
Option 2: use the "mixpanel.time_event" call
After "time_event" is called for a certain event, a "timer" is started and will stop when that specific event is triggered later on. The time difference between the "time_event" call and the event itself will be indicated automatically as a property of the event:
- We can call mixpanel.time_event("Lesson end").
- And 3 minutes later, call mixpanel.track("Lesson end").
Now, the event "Lesson end" will automatically have a property called "Duration" with the value "217,479" which indicates how many seconds went by from one call to the other.
Another benefit of this tracking option is that it provides more granularity: the “Duration” property will be part of the event’s raw data, so you’ll be able to query it from different Mixpanel reports, not only Funnels.
Lastly, you can use a Formula in your Insights report to visualize the Duration value in minutes (dividing by 60) or in hours (dividing by 360):
To learn more about Insights and how to use a property in this report check this article.