Custom Events¶
Part of the Human Scoring use case.
Mark meaningful moments in your app on the session timeline — a level starting, a form step completing, a checkout opening. Custom events annotate the session. They are not scored, so they cannot be used to make a session look more human.
Note: Custom events stay on the device. The production SDK does not send them anywhere; with
debugon, each one shows in Logcat as aCustomObjectline.
When to use it¶
- To mark the steps of a flow:
checkout_open,payment_submit - To mark game or task boundaries:
level_start,round_end
Prerequisites¶
- The SDK is installed and initialized. See the Quick Start.
- The user has consented. Events are not recorded before consent.
eventsincludesCaptureEvent.CUSTOM. It does by default.
Usage¶
Record an event¶
Record an event with data¶
captureEvent returns true when the event was recorded and false when it was not.
Limits¶
| Limit | If exceeded | |
|---|---|---|
| Name | 1 to 64 characters | The whole event is dropped |
| Data | 1024 bytes as JSON | The whole event is dropped |
Android does not shorten a long name; it drops the event. Events are also ignored, and
captureEvent returns false, while capture is paused, before
consent, and after dispose().
Use values JSON can represent: strings, numbers, booleans, null, and lists and maps of those.
Any other value is recorded as null.
Do not put personal information in names or data.
Examples¶
Mark the rounds of a game¶
import ai.dea.sdk.DeaSdk
class GameController {
private var round = 0
fun startRound() {
round++
DeaSdk.instance?.captureEvent("round_start", mapOf("round" to round))
}
fun endRound(won: Boolean) {
DeaSdk.instance?.captureEvent("round_end", mapOf("round" to round, "won" to won))
}
}
API¶
| Member | Returns | Description |
|---|---|---|
captureEvent(name, data = null) |
Boolean |
Records an event on the session timeline; false when it was dropped or ignored |