Configure Marketing Cloud Engagement
Runtime Toggles
Event Tracking
Handle URLs
Data Protection and Privacy
Changelog
Use runtime toggles to configure SDK features without reinitializing the SDK. Use runtime toggles to turn these features on or off:
Use runtime toggles to fine-tune the behavior of your app, adapt to changing requirements, and comply with privacy regulations. The SDK provides APIs for getting and setting the status of each feature.
These code examples show how to use runtime toggles.
For version 10 or later of the SDK for Android, use this code.
1MarketingCloudSdk.requestSdk { engagementSdk ->
2 // Analytics
3 engagementSdk.analyticsManager.enableAnalytics() // or disableAnalytics()
4 engagementSdk.analyticsManager.areAnalyticsEnabled()
5
6 engagementSdk.analyticsManager.enablePiAnalytics() // or disablePiAnalytics()
7 engagementSdk.analyticsManager.arePiAnalyticsEnabled()
8
9 // Messaging
10 engagementSdk.inboxMessageManager.enableInbox() // or disableInbox()
11 engagementSdk.inboxMessageManager.isInboxEnabled()
12
13 engagementSdk.regionMessageManager.enableGeofenceMessaging() // or disableGeofenceMessaging()
14 engagementSdk.regionMessageManager.isGeofenceMessagingEnabled()
15
16 engagementSdk.regionMessageManager.enableProximityMessaging() // or disableProximityMessaging()
17 engagementSdk.regionMessageManager.isProximityMessagingEnabled()
18}For version 10 or later of the SDK for iOS, use this code.
1MarketingCloudSdk.requestSdk { mc in
2 //Analytics
3 mc?.setAnalyticsEnabled(_: Bool)
4 mc?.isAnalyticsEnabled()
5
6 mc?.setPiAnalyticsEnabled(_: Bool)
7 mc?.isPiAnalyticsEnabled()
8
9 //Messaging
10 mc?.setLocationEnabled(_: Bool)
11 mc?.isLocationEnabled()
12
13 mc?.setInboxEnabled(_: Bool)
14 mc?.isInboxEnabled()
15}For version 8 of the SDK for Android, use this code.
1SFMCSdk.requestSdk {
2 it.mp { push ->
3 // Analytics
4 push.analyticsManager.enableAnalytics() // or disableAnalytics()
5 push.analyticsManager.areAnalyticsEnabled()
6
7 push.analyticsManager.enablePiAnalytics() // or disablePiAnalytics()
8 push.analyticsManager.arePiAnalyticsEnabled()
9
10 // Messaging
11 push.inboxMessageManager.enableInbox() // or disableInbox()
12 push.inboxMessageManager.isInboxEnabled()
13
14 push.regionMessageManager.enableGeofenceMessaging() // or disableGeofenceMessaging()
15 push.regionMessageManager.isGeofenceMessagingEnabled()
16
17 push.regionMessageManager.enableProximityMessaging() // or disableProximityMessaging()
18 push.regionMessageManager.isProximityMessagingEnabled()
19 }
20}For version 8 of the SDK for iOS, use this code.
1SFMCSdk.requestPushSdk { mp in
2 //Analytics
3 mp.setAnalyticsEnabled(_: Bool)
4 mp.isAnalyticsEnabled()
5
6 mp.setPIAnalyticsEnabled(_: Bool)
7 mp.isPiAnalyticsEnabled()
8
9 //Messaging
10 mp.setLocationEnabled(_: Bool)
11 isLocationEnabled()
12
13 mp.setInboxEnabled(_: Bool)
14 mp.isInboxEnabled()
15}When you use the runtime toggle to turn off analytics, the SDK removes all non-billable analytics and stops recording new non-billable analytics.
Non-billable analytics include data used in reports that help you track messaging effectiveness, such as open rates for push notifications and inbox messages.
Billable analytics tell Marketing Cloud Engagement about billable actions without collecting user-specific information. Even when you turn off analytics, the SDK sends data for billable events only, with no user-related details from the device.