Skip to main content

Moments

Overview

Embrace contains a powerful stopwatch and abandonment tracking feature, which we call moments. This mechanism is the same one used to measure application launch performance, which we covered in the Session Reporting section.

Similar to Logs, moments will immediately make a network request.

info

The performance of the networking calls that moments make are unrelated to the performance of the moment itself.

Keep It Short

Moments are best used for tracking critical user flows that are generally short in nature, like:

  1. Rendering a border onto an image
  2. Uploading a file to your server
  3. Loading a new set of TableView cells from a local database
  4. Processing the checkout from your shopping cart

Longer events, such as filling out an entire form or taking a photo with the camera, are worse candidates for moments as these tasks can have a high variance from user to user. Only measure moments that truly matter to your business, and that you would dedicate engineering resources to improving.

Starting a Moment

Here's how you start a moment.

Embrace.getInstance().startMoment("addItem");

In a sample scenario, this is a moment we're using to measure how quickly an item is added to a ListView after a user selects the plus button.

You can also start a moment with properties, an identifier, and screenshots. For more on this, check out the API docs.

Limits on Properties
  • Property keys have a limit of 128 characters.
  • Property values have a limit of 256 characters.
  • You can have up to 100 properties(the limit can be increased on Android SDK 5.14.2 or iOS SDK 5.16.1 and above). Reach out to support@embrace.io to enable this.

Ending a Moment

Next, here's how you end a moment.

Embrace.getInstance().endMoment("addItem");

A timer is started once you make a call to start a moment. If you end the moment within a configurable threshold, then the timer ends and the client's measurement is used to report performance. You can end the moment from multiple locations in your app, or from multiple threads.

Tracking Abandonment

Moments measure abandonment by default.

If the moment never completes, because:

  • the user exits the app before the moment ends
  • the app crashes
  • an unexpected code path is taken

the timer runs out, and we record that moment as an abandonment. Looking at these later can help you to understand user behavior and how changes you make affect it over time.