Capturing Behavior Data
- The Data Cloud 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.
- Consent to track must be granted.
Behavioral lifecycle and screen events are disabled by default in the Data Cloud 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 ForegroundedFor 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 BackgroundedFor 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}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
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}