Sending events on iOS

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 an NSDictionary object.

To send your custom event with nested parameters, use the +reportEvent:params:onFailure: method of the YMMYandexMetrica class:

NSDictionary *params = @{@"key1": @"value1", @"key2": @"value2"};
[YMMYandexMetrica reportEvent:@"EVENT"
                   parameters:params
                    onFailure:^(NSError *error) {
                        NSLog(@"error: %@", [error localizedDescription]);
                    }];

The report in the web interface shows the following:

To send your custom event with nested parameters, use the reportEvent(_:parameters:onFailure:) method of the YMMYandexMetrica class:

let params : [AnyHashable : Any] = ["key1": "value1", "key2": "value2"]
YMMYandexMetrica.reportEvent("EVENT", parameters: params, onFailure: { (error) in
    print("DID FAIL REPORT EVENT: %@", message)
    print("REPORT ERROR: %@", error?.localizedDescription)
})

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.

Contact support