Moments
The Moments API is deprecated and no longer supported as of Unity 2.x. Please use Spans instead
Overview
Embrace also 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.
Starting a Moment
Here's how you start a moment.
Embrace.Instance.StartMoment("addItem");
In a sample scenario, this is a moment we're using to measure how quickly an item is added to a list after a user selects the plus button.
You can also start a moment with properties and identifier. You can filter moments by properties in the dashboard. For more on this, check out the source code.
- Property keys have a limit of 128 characters.
- Property values have a limit of 1024 characters.
- The default limit for session properties is 10. 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 increase this.
Ending a Moment
Next, here's how you end a moment.
Embrace.Instance.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.
Tracking Abandonment
In addition to measuring performance, moments can also measure 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