Skip to content


Tracking custom events for iOS

You can record custom events in Braze to learn more about your app’s usage patterns and to segment your users by their actions on the dashboard.

Before implementation, be sure to review examples of the segmentation options afforded by custom events, custom attributes, and purchase events in our best practices, as well as our notes on event naming conventions.

Adding a custom event

1
[[Appboy sharedInstance] logCustomEvent:@"YOUR_EVENT_NAME"];
1
Appboy.sharedInstance()?.logCustomEvent("YOUR_EVENT_NAME")

Adding properties

You can add metadata about custom events by passing an NSDictionary populated with NSNumber, NSString, or NSDate values.

1
2
3
4
5
6
7
8
9
10
11
[[Appboy sharedInstance] logCustomEvent:@"YOUR-EVENT-NAME"
                         withProperties:@{
  @"you": @"can",
  @"pass": @(NO),
  @"orNumbers": @42,
  @"orDates": [NSDate date],
  @"or": @[@"any", @"array", @"here"],
  @"andEven": @{
    @"deeply": @[@"nested", @"json"]
  }
}];
1
2
3
4
5
6
7
8
9
10
11
12
13
Appboy.sharedInstance()?.logCustomEvent(
  "YOUR-EVENT-NAME",
  withProperties: [
    "you": "can",
    "pass": false,
    "orNumbers": 42,
    "orDates": Date(),
    "or": ["any", "array", "here"],
    "andEven": [
      "deeply": ["nested", "json"]
    ]
  ]
)

Refer to our class documentation for more information.

Reserved keys

The following keys are reserved and cannot be used as custom event properties:

  • time
  • event_name

Additional resources

  • See the method declaration within the Appboy.h file.
  • Refer to the logCustomEvent documentation for more information.
HOW HELPFUL WAS THIS PAGE?
New Stuff!