Collecting Usage Statistics

Track key performance indicators (KPIs) such as device types, operating systems, and SDKs.


The SDK components automatically log some predefined events and metrics. You can also log custom-defined timers, events, and measurements.

To collect statistics, you need the Windows Native Client SDK libraries, which are available as part of the SAP Mobile Platform Client SDK Installer. The Usage library ships in the form of separate artifacts, such as statically linked libraries and public header files.

If the server on which statistics are being collected uses a HANA database, the database must use a flexible schema.

Before you can use the Usage library, you must add associated artifacts to your project. You must also add dependent frameworks and configure your build settings. If you are working with an existing project rather than creating a new one, the steps may differ.


  1. In Visual Studio, create a new project or open an existing one.
  2. Set the Title and Version properties of the app manifest in your project.

    The Usage library reads these values and uses them as application ID and version number values.

  3. To enable the Usage library to automatically upload the logs in an encrypted form, add these libraries from the SDK.
    • SAP.Net library
    • SAP.SecureStore library
    • SAP.Supportability library
    The Secure Store is required to store the data in an encrypted form. The Supportability component is required to create and store library-related logs.
  4. Select your project from the Project Navigator, and choose your application's target.
  5. Implement the necessary code.
    1. Initialize the usage library:
      httpClient = new SAP.Net.Http.HttpClient();
      await Usage.InitUsageAsync(uploadUrl, httpClient);
    2. After initialization, you can start timers to measure certain events. For example, you can start a timer when the MasterViewController is loaded:
    3. To stop the timer:
      await Usage.TimeEndAsync("MyTimer");
    4. To manage the timer instance, you can start and get a Timer object by calling:
      var myTimer = Usage.MakeTimer("MyTimer");
    5. Stop and persist a timer by calling:
      await Usage.StopTimerAsync(myTimer);
    6. To log an event, for example, when an item is added or a button is pressed, use the log APIs:
      await Usage.LogAsync("id", 
      new Dictionary<string, string>() 
      { { "testKey", "testValue" } }, "type");