The Dynatrace OneAgent supports privacy-first data collection by allowing developers to configure the level of data collection and crash reporting based on user consent. The OneAgent provides APIs to:
For more information on configuring data privacy in mobile applications, see Configure data privacy settings for mobile applications.
While Dynatrace offers numerous data privacy settings, it's your responsibility to properly configure these settings and implement appropriate consent mechanisms to protect your users' personal data.
The OneAgent supports three levels of data collection, defined by the DTX_DataCollectionLevel:
| Level | Description |
|---|---|
off | No data is collected. |
performance | Collects performance-related data, such as app crashes and ANRs. |
userBehavior | Collects both performance data and user behavior data, such as user actions. |
User opt-in mode requires explicit user consent before collecting monitoring data. When enabled, the agent starts with minimal data collection until the user grants consent.
When user opt-in mode is enabled, the following defaults apply until the user sets their preferences:
off (no monitoring data is sent).false (crash reports are not sent).To enable user opt-in mode, configure the DTXUserOptIn key in your application's Info.plist file:
<key>DTXUserOptIn</key><true/>
For more information about configuration keys, see iOS Configuration Keys for OneAgent.
Dynatrace doesn't provide a consent dialog UI. You must implement your own consent banner or dialog within your application. The dialog should:
Use the privacy API to get and apply user privacy preferences.
Set the user's privacy preferences using the applyUserPrivacyOptions API.
let privacyOptions = Dynatrace.userPrivacyOptions()privacyOptions.dataCollectionLevel = .userBehaviorprivacyOptions.crashReportingOptedIn = trueDynatrace.applyUserPrivacyOptions(privacyOptions) { success inif success {print("Privacy options applied successfully.")}}
let privacyOptions = Dynatrace.userPrivacyOptions()privacyOptions.dataCollectionLevel = .performanceprivacyOptions.crashReportingOptedIn = falseDynatrace.applyUserPrivacyOptions(privacyOptions)
let privacyOptions = Dynatrace.userPrivacyOptions()privacyOptions.dataCollectionLevel = .offprivacyOptions.crashReportingOptedIn = falseDynatrace.applyUserPrivacyOptions(privacyOptions)
When you apply new privacy options, a new session is created with the specified settings. The settings are stored and automatically applied to future sessions.
For more information about privacy and security settings, refer to the iOS Configuration Keys for OneAgent page.