Uncategorized

Measure how long things take within your iOS app

We realize that it’s important to understand how long various actions take within your apps. For instance, if it’s taking 30 seconds from the time a user clicks the login button until they see their account screen, they’ll most likely stop using your app. Recently in v2.5.3, we added a small stopwatch to our iOS SDK, which will make measuring the duration of events in your app as simple as possible.

Many events our customers track – like image uploads, user signups, and level ups – are often associated with the duration of time they took to complete. With the addition of “timeEvent“, you’ll be able to start a clock for an upcoming event and guarantee that a future
track” will include elapsed time (in seconds) as a property.

Let’s dive into the code.

Imagine, we have an app and want to know why some users are complaining about the time it takes to upload their profile pictures. As we’re pretty big data heads, we already track an event upon success.

[self uploadImageWithSuccessHandler:^{
    [mixpanel track:@"Profile Image Upload"];
}];

Timing this event is as easy as adding one more line.

[mixpanel timeEvent:@"Profile Image Upload"]; // start the timer
[self uploadImageWithSuccessHandler:^{
    [mixpanel track:@"Profile Image Upload"]; // send event with elapsed time
}];

With this new timing in place, we’ll be able to tell which versions of our app have the slowest uploads and identify any outliers.

This will work even if the user sends your app to the background or closes it entirely while the timer is running, making it ideal for phone calls and text interruptions, and we’re excited to see the sorts of insight this gives into things like average latency and velocity of user actions.

For more technical information, check out our updated help docs. Or you can reach out to support@mixpanel.com to speak to someone smart, quickly.

Get the latest from Mixpanel
This field is required.