Quick start

You can use the Windows SDK for mobile and desktop applications. The SDK is provided as a NuGet package. Install the NuGet package manager, if you have not installed it yet.

To get started, add the AppMetrica library to the app and configure it:

  1. Add the following access permissions to WMAppManifest :


  2. Use one of the methods below to start collecting application statistics.

    If you are connecting the SDK to a desktop application, before you start collecting statistics, you must set the folder for storing files using the Yandex.Metrica.YandexMetricaFolder.SetCurrent(string path) method.

    In the App.xaml.cs file

    Add an element describing the metrica:YandexMetricaActivator resource and specify:

    • The resource key (x:Key). This is an arbitrary key.
    • ApiKey is a unique application identifier that is issued in the AppMetrica web interface during app registration. After the app has been registered, ApiKey is available in editing mode.

    Example of contents of the App.xaml file:

                ApiKey="your application's API key" />
    Directly from the application code

    Use the method YandexMetrica.Activate(string apiKey):

    YandexMetrica.Activate(apiKey: your app's API key);

Statistics will start being collected as soon as the app is launched.

The maximum volume of locally stored data is 2 MB.