Skip to content

Tracking custom events

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
AppDelegate.braze?.logCustomEvent(name: "YOUR_EVENT_NAME")
1
[AppDelegate.braze logCustomEvent:@"YOUR_EVENT_NAME"];

Adding properties

You can add metadata about custom events by passing a Dictionary populated with Int, Double, String, Bool, or Date values.

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

Reserved keys

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

  • time
  • event_name

Additional resources

HOW HELPFUL WAS THIS PAGE?
New Stuff!