YandexMetrica class
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.
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.
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.
ReportEvent
public static void ReportEvent(string eventName)
Sends an event message.
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.
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.
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.
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.
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.