YandexMetrica class

yandex.metrica

public class YandexMetrica

Methods of the class are used for configuring the library.

Nested classes

Methods

voidActivate(string apiKey)

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

voidActivate(Guid apiKey)

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

YandexMetrica.YandexMetricaConfigConfig

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

voidReportError(string message, Exception )

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

voidReportEvent(string eventName)

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

voidReportEvent(string eventName, string jsonData)

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

voidReportEvent<TItem>(string eventName, TItem serializableItem)

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

voidReportLaunchUri(Uri uri)

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

voidReportUnhandledException(Exception exception)

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

voidSnapshot()

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

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.

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.

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.

ReportEvent

public static void ReportEvent(string eventName)

Sends an event message.

Parameters:
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

jsonDataA 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

serializableItemThe 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:
uriThe 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.

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.