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 AppMetrica.reportEvent(String eventName, String jsonValue)
method. JSON should be passed as a string:
String eventParameters = "{\"name\":\"Alice\", \"age\":\"18\"}";
AppMetrica.reportEvent("New person", eventParameters);
The report in the web interface shows the following:
To send event parameters as a Map object, use the AppMetrica.reportEvent(String eventName, Map<String, Object> attributes)
method:
Map<String, Object> eventParameters = new HashMap<String, Object>();
eventParameters.put("name", "Alice");
eventParameters.put("age", 18);
AppMetrica.reportEvent("New person", eventParameters);
The report in the web interface shows the following:
See also
If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.