Custom Event (Version 3.x)

A custom event lets you track unique user interactions and send data that isn’t covered by standard events. You can include a flexible payload of user-defined attributes to capture the specific details of an interaction. You can then map these attributes to a Custom Event Schema in Data 360 using the Mobile Schema naming conventions.

Custom Event Example for iOS 

Here’s an example of a custom event that captures a user’s gift preferences.

1CustomEvent(
2    name: "Custom Event",
3    attributes: [
4        "giftWrap" : true,
5        "giftMessage" : "Happy Birthday",
6        "giftWrapOptions": [
7            "paperColor": "green",
8            "ribbon": false
9  ]
10    ]
11)

Custom Event Example for Android 

Here’s an example showing the same custom event for capturing a user’s gift preferences on Android.

1EventManager.customEvent(
2    name = "Custom Event",
3    attributes = mapOf(
4        "gift" to mapOf(
5            "message" to "Happy Birthday",
6            "wrap" to true,
7            "wrapOptions" to mapOf(
8                "paper-color" to "green",
9                "ribbon" to false
10            )
11        )
12    )
13)?.track()

Nested attribute keys are flattened using parent-child naming (for example, gift.message becomes giftMessage) per the schema mapping rules.