Sending events on Android
You can send multi-level events in AppMetrica. For more information about displaying multi-level events, see Events.
To send a multi-level event, pass a key:value
pair in the event parameters. In the interface, key
and value
are considered nesting levels. Event parameters can be sent as a JSON or Map object.
To send event parameters in JSON format, use the YandexMetrica.reportEvent(String eventName, String jsonValue) method. JSON should be passed as a string:
String eventParameters = "{\"name\":\"Alice\", \"age\":\"18\"}"; YandexMetrica.reportEvent("New person", eventParameters);
Copied to clipboard
The report in the web interface shows the following:
To send event parameters as a Map object, use the YandexMetrica.reportEvent(String eventName, Map<String, Object> attributes) method:
Map<String, Object> eventParameters = new HashMap<String, Object>(); eventParameters.put("name", "Alice"); eventParameters.put("age", 18); YandexMetrica.reportEvent("New person", eventParameters);
Copied to clipboard
The report in the web interface shows the following: