App Center Analytics

App Center Analytics helps you understand user behavior and customer engagement to improve your app. The SDK automatically captures session count and device properties like model, OS version, etc. You can define your own custom events to measure things that matter to you. All the information captured is available in the App Center portal for you to analyze the data.

Please follow the Get started section if you haven't set up the SDK in your application yet.

Session and device information

Once you add App Center Analytics to your app and start the SDK, it will automatically track sessions and device properties like OS Version, model, etc. without writing any additional code.

Custom events

You can track your own custom events with up to twenty properties to understand the interaction between your users and the app.

Once you have started the SDK, use the TrackEvent() method to track your events with properties. You can send up to 200 distinct event names. Also, there is a maximum limit of 256 characters per event name and 125 characters per event property name and event property value.

Analytics.TrackEvent("Video clicked", new Dictionary<string, string> {
	{ "Category", "Music" },
	{ "FileName", "favorite.avi"}
});

Properties for events are entirely optional – if you just want to track an event, use this sample instead:

Analytics.TrackEvent("Video clicked");

Enable or disable App Center Analytics at runtime

You can enable and disable App Center Analytics at runtime. If you disable it, the SDK will not collect any more analytics information for the app.

Analytics.SetEnabledAsync(false);

To enable App Center Analytics again, use the same API but pass true as a parameter.

Analytics.SetEnabledAsync(true);

You don't need to await this call to make other API calls (such as IsEnabledAsync) consistent.

The state is persisted in the device's storage across application launches.

Note

This method must only be used after Analytics has been started.

Check if App Center Analytics is enabled

You can also check if App Center Analytics is enabled or not.

bool isEnabled = await Analytics.IsEnabledAsync();

Note

This method must only be used after Analytics has been started, it will always return false before start.

Local storage size

By default, the SDK stores up to 10MB of logs in the storage.

No internet access

When there is no network connectivity, the SDK saves up to 10MB of logs in the local storage. Once the storage is full, the SDK will start discarding old logs to make room for the new logs. Once the device gets internet access back, the SDK will send logs in the batch of 50 or after every 3 seconds.

Batching event logs

The App Center SDK uploads logs in a batch of 50 and if the SDK doesn't have 50 logs to send, it will still send logs after 3 seconds. There can be a maximum of 3 batches sent in parallel.

Retry and back-off logic

App Center SDK supports back-off retries on recoverable network errors. Below is the retry logic:

  • 3 tries maximum per request.
  • Each request has its own retry state machine.
  • All the transmission channels are disabled (until next app process) after 1 request exhausts all its retries.

Back-off logic

  • 50% randomization, 1st retry between 5 and 10s, second retry between 2.5 and 5 minutes, last try between 10 and 20 minutes.
  • If network switches from off to on (or from wi-fi to mobile), retry states are reset and requests are retried immediately.