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]); }];
Copied to clipboard
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) })
Copied to clipboard
The report in the web interface shows the following: