Dynatrace provides privacy settings that allow you to control the amount of data collected from your users. These settings help ensure compliance with data protection regulations such as GDPR while still providing valuable insights into application performance. OneAgent supports privacy-first data collection, giving developers control over data collection levels, crash reporting, and user privacy options at runtime. Additionally, OneAgent allows you to redact sensitive data from reported events.
OneAgent supports three levels of data collection, defined by the DataCollectionLevel.
| Level | Description |
|---|---|
| No data is collected. |
| Collects performance-related data, such as app crashes and ANRs. |
| Collects both performance data and user behavior data. |
At the Performance level, performance data is collected by default, including user interactions, web requests, errors, and screen flows. However, crashes and ANRs are only reported if crash reporting is explicitly enabled via the crash reporting opt-in flag; if disabled, no crash or ANR data is collected despite the level description. See Enable or disable crash reporting.
Configure the data collection level using the applyUserPrivacyOptions API.
import com.dynatrace.android.agent.Dynatraceimport com.dynatrace.android.agent.conf.UserPrivacyOptionsimport com.dynatrace.android.agent.conf.DataCollectionLevelval privacyOptions = Dynatrace.getUserPrivacyOptions()val updatedOptions = privacyOptions.newBuilder().withDataCollectionLevel(DataCollectionLevel.PERFORMANCE).build()Dynatrace.applyUserPrivacyOptions(updatedOptions)
The user opt-in feature allows developers to comply with privacy regulations by explicitly obtaining user consent before collecting data or enabling crash reporting. This feature ensures that users have control over their data and can make informed decisions about their privacy.
When the user opt-in feature is enabled, OneAgent does not collect any data or enable crash reporting until the user explicitly provides consent. Developers can use the applyUserPrivacyOptions API to update the privacy settings based on the user's preferences.
When user opt-in mode is enabled, before a user explicitly provides consent, OneAgent uses the following default settings:
OFF (no data collected).false (disabled).By using user opt-in mode, developers can ensure compliance with privacy regulations and provide users with greater control over their data.
User opt-in mode is optional. Without it, OneAgent collects data and reports crashes by default, without requiring user consent. When enabled, your application must provide a consent UI to the end user; until the user explicitly grants consent, no data is collected and crash reporting remains off. To enable opt-in mode, update your Gradle configuration:
Gradle plugin configuration:
dynatrace {configurations {defaultConfig {userOptIn true}}}
Manual startup configuration:
DynatraceConfigurationBuilder("<YourApplicationID>", "<ProvidedBeaconURL>").withUserOptIn(true).buildConfiguration()
Dynatrace doesn't provide a consent dialog UI. You must implement your own consent banner or dialog within your application (as described in Configure data privacy settings for mobile applications. The dialog should:
The applyUserPrivacyOptions API allows you to dynamically update privacy settings at runtime. This is useful for implementing user consent dialogs or privacy settings screens.
When opt-in mode is disabled, crash reporting is enabled by default. When opt-in mode is enabled, crash reporting is off until the user explicitly grants consent. When enabled, OneAgent collects crash data to help developers diagnose and fix issues in their applications.
Use the applyUserPrivacyOptions API to enable or disable crash reporting:
import com.dynatrace.android.agent.Dynatraceimport com.dynatrace.android.agent.conf.UserPrivacyOptionsval privacyOptions = Dynatrace.getUserPrivacyOptions()val updatedOptions = privacyOptions.newBuilder().withCrashReportingOptedIn(true) // Enable crash reporting.build()Dynatrace.applyUserPrivacyOptions(updatedOptions)
import com.dynatrace.android.agent.Dynatraceimport com.dynatrace.android.agent.conf.UserPrivacyOptionsimport com.dynatrace.android.agent.conf.DataCollectionLevelval privacyOptions = Dynatrace.getUserPrivacyOptions()val updatedOptions = privacyOptions.newBuilder().withDataCollectionLevel(DataCollectionLevel.USER_BEHAVIOR).withCrashReportingOptedIn(false).build()Dynatrace.applyUserPrivacyOptions(updatedOptions)
When Dynatrace is used in an Android app distributed via Google Play, the following privacy information has to be added within Google Play.