Capturing Behavior Data

The Customer Data Platform Module for the Engagement Mobile SDK enables collection of granular data about customer’s mobile app interactions through event tracking.
Before behavior data can be sent to Customer Data Platform:
  1. The Customer Data Platform Module for the Engagement Mobile SDK must be configured and initialized.
    • To enable Lifecycle Events, set trackLifecycle to true.
    • To enable Screen Events, set trackScreens to true.
  2. Consent to track must be granted.

Behavioral lifecycle and screen events are disabled by default in the Customer Data Platform Module.

Each of the behaviors generates an engagement event with eventType="appEvents" and fields relevant to the behavior populated.

Lifecycle Events

Lifecycle behaviors are triggered when a mobile application transitions to the foreground or background on a mobile device or when the mobile application is updated.

On Application Foregrounded

For example, when the mobile application is foregrounded an event is generated:

1{
2  "behaviorType": "AppLaunch",
3  "appName": "MyAppName",
4  "appVersion": "1.0.0",
5  "eventType": "appEvents",
6  "category": "Engagement",
7  // + all automatically assigned fields like deviceId, sessionId, dateTime, etc.
8}

The first time the application launches behaviorType="AppFirstLaunch" is set.

On Application Backgrounded

For example, when the mobile application is backgrounded an event is generated:

1{
2  "behaviorType": "AppBackgrounded",
3  "appName": "MyAppName",
4  "appVersion": "1.0.0",
5  "eventType": "appEvents",
6  "category": "Engagement",
7  // + all automatically assigned fields like deviceId, sessionId, dateTime, etc.
8}
On Application Version Changed

For example, when the mobile application is updated an event is generated:

1{
2  "behaviorType": "AppUpdate",
3  "previousAppVersion": "1.0.0",
4  "appName": "MyAppName",
5  "appVersion": "1.2.3",
6  "eventType": "appEvents",
7  "category": "Engagement",
8  // + all automatically assigned fields like deviceId, sessionId, dateTime, etc.
9}

Screen Events

On-Screen View

For example, when a customer is navigating through Activity views in an Android application or as UIViewControllers are added to a view hierarchy in iOS, an event is generated:

1{
2  "behaviorType": "ScreenView",
3  "screenName": "MyScreenName",
4  "appName": "MyAppName",
5  "appVersion": "1.0.0",
6  "eventType": "appEvents",
7  "category": "Engagement",
8  // + all automatically assigned fields like deviceId, sessionId, dateTime, etc.
9}