Privacy and data collection

  • Latest Dynatrace
  • Explanation
  • Published Dec 24, 2025

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:

  • Control data collection levels—choose between collecting no data, performance data, or user behavior data.
  • Activate or deactivate crash reporting—allow users to opt in or out of crash reporting.
  • Apply user privacy options dynamically—update privacy settings at runtime based on user preferences.

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.

Data collection levels

The OneAgent supports three levels of data collection, defined by the DTX_DataCollectionLevel:

LevelDescription
offNo data is collected.
performanceCollects performance-related data, such as app crashes and ANRs.
userBehaviorCollects both performance data and user behavior data, such as user actions.

User opt-in mode

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.

Default behavior

When user opt-in mode is enabled, the following defaults apply until the user sets their preferences:

  • Data collection level: off (no monitoring data is sent).
  • Crash reporting: false (crash reports are not sent).

Enable user opt-in mode

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:

  • Explain what data will be collected.
  • Allow users to choose their preferred data collection level.
  • Allow users to enable or disable crash reporting.
  • Provide a way for users to change their preferences later.

Privacy API

Use the privacy API to get and apply user privacy preferences.

Apply privacy options

Set the user's privacy preferences using the applyUserPrivacyOptions API.

let privacyOptions = Dynatrace.userPrivacyOptions()
privacyOptions.dataCollectionLevel = .userBehavior
privacyOptions.crashReportingOptedIn = true
Dynatrace.applyUserPrivacyOptions(privacyOptions) { success in
if success {
print("Privacy options applied successfully.")
}
}

Grant performance monitoring only without crash reporting

let privacyOptions = Dynatrace.userPrivacyOptions()
privacyOptions.dataCollectionLevel = .performance
privacyOptions.crashReportingOptedIn = false
Dynatrace.applyUserPrivacyOptions(privacyOptions)
let privacyOptions = Dynatrace.userPrivacyOptions()
privacyOptions.dataCollectionLevel = .off
privacyOptions.crashReportingOptedIn = false
Dynatrace.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.

Additional resources

For more information about privacy and security settings, refer to the iOS Configuration Keys for OneAgent page.

Related tags
Digital Experience