YandexMetrica class

Attention. We discontinued the development of new versions of the AppMetrica Windows SDK.

yandex.metrica

public class YandexMetrica

Methods of the class are used for configuring the library.

Nested classes

Methods

void Activate(string apiKey)

Инициализирует библиотеку в приложении с указанным API key.

void Activate(Guid apiKey)

Инициализирует библиотеку в приложении с указанным API key.

YandexMetrica.YandexMetricaConfig Config

Метод для доступа к вложенному классу YandexMetrica.YandexMetricaConfig.

void ReportError(string message, Exception )

Отправляет сообщение об ошибке.

void ReportEvent(string eventName)

Отправляет сообщение о событии.

void ReportEvent(string eventName, string jsonData)

Отправляет сообщение о событии в формате JSON в виде строки.

void ReportEvent<TItem>(string eventName, TItem serializableItem)

Отправляет сообщение о событии c дополнительными параметрами.

void ReportLaunchUri(Uri uri)

Отправляет сообщение об открытии приложения с помощью deeplink.

void ReportUnhandledException(Exception exception)

Отправляет сообщение о необработанном исключении.

void Snapshot()

Кэширует неотправленные события в памяти устройства.

void Activate(string apiKey)

Инициализирует библиотеку в приложении с указанным API key.

void Activate(Guid apiKey)

Инициализирует библиотеку в приложении с указанным API key.

YandexMetrica.YandexMetricaConfig Config

Метод для доступа к вложенному классу YandexMetrica.YandexMetricaConfig.

void ReportError(string message, Exception )

Отправляет сообщение об ошибке.

void ReportEvent(string eventName)

Отправляет сообщение о событии.

void ReportEvent(string eventName, string jsonData)

Отправляет сообщение о событии в формате JSON в виде строки.

void ReportEvent<TItem>(string eventName, TItem serializableItem)

Отправляет сообщение о событии c дополнительными параметрами.

void ReportLaunchUri(Uri uri)

Отправляет сообщение об открытии приложения с помощью deeplink.

void ReportUnhandledException(Exception exception)

Отправляет сообщение о необработанном исключении.

void Snapshot()

Кэширует неотправленные события в памяти устройства.

Method descriptions

Activate

public static void Activate(string apiKey)

Initializes the library in the application with the specified API key.

Use this method to initialize the library directly from the application code.

If the library initialized in the App file.xaml, you don't need to initialize the library from code.

Parameters:
apiKey The API key of the application.
apiKey The API key of the application.

Activate

public static void Activate(Guid apiKey)

Initializes the library in the application with the specified API key.

Use this method to initialize the library directly from the application code.

If the library initialized in the App file.xaml, you don't need to initialize the library from code.

Parameters:
apiKey The API key of the application.
apiKey The API key of the application.

Config

public static readonly YandexMetrica.YandexMetricaConfig Config

Methods for accessing the YandexMetrica.YandexMetricaConfig nested class.

Returns:

The instance of the YandexMetrica.YandexMetricaConfig class.

ReportError

public static void ReportError(string message, Exception exception)

Sends a custom error message.

Parameters:
message

Short name or description of the error.

exception

The instance of the Exception system class.

message

Short name or description of the error.

exception

The instance of the Exception system class.

ReportEvent

public static void ReportEvent(string eventName)

Sends an event message.

Parameters:
eventName

Short name or description of the event

eventName

Short name or description of the event

ReportEvent

public static void ReportEvent(string eventName, string jsonData)

Sends an event message as a string in JSON format.

Parameters:
eventName

Short name or description of the event

jsonData A valid JSON string with custom content. Five nesting levels are available for a JSON object.
eventName

Short name or description of the event

jsonData A valid JSON string with custom content. Five nesting levels are available for a JSON object.

ReportEvent

public static void ReportEvent<TItem>(string eventName, TItem serializableItem)

Sends an event message with additional parameters.

Parameters:
eventName

Short name or description of the event

serializableItem The value of the event. It is converted to a JSON string by the DataContractJsonSerializer system class.
eventName

Short name or description of the event

serializableItem The value of the event. It is converted to a JSON string by the DataContractJsonSerializer system class.

ReportLaunchUri

public static void ReportLaunchUri(Uri uri)

Sends a message about the app launching from a deeplink.

Parameters:
uri The instance of the Uri system class that contains a deeplink.
uri The instance of the Uri system class that contains a deeplink.

ReportUnhandledException

public static void ReportUnhandledException(Exception exception)

Sends a message about an unhandled exception.

To avoid exception events duplication, set the false value for the YandexMetrica.Config.CrashTracking property.

Parameters:
exception

The instance of the Exception system class.

exception

The instance of the Exception system class.

Snapshot

public static void Snapshot()

Caches unsent events in the device memory.

This method must be called before shutting down C++ applications or background tasks.

The maximum volume of locally stored data is 2 MB.