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. 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 is your responsibility to properly configure these settings and implement appropriate consent mechanisms to protect your users' personal data.
The Dynatrace Flutter plugin supports three data collection levels that determine what information is captured and sent to Dynatrace.
The possible values for the data collection level are as follows:
OFFPERFORMANCEUSER_BEHAVIORUser opt-in mode requires explicit user consent before collecting monitoring data. When activated, the agent starts with minimal data collection until the user grants consent.
When user opt-in mode is activated, the following defaults apply until the user sets their preferences:
Off (no monitoring data is sent).false (crash reports are not sent).To activate user opt-in mode, update your dynatrace.config.yaml file:
Android:
android:config:"dynatrace {configurations {defaultConfig {userOptIn true}}}"
iOS:
ios:config:"<key>DTXUserOptIn</key><true/>"
After updating the configuration, run dart run dynatrace_flutter_plugin to apply the changes.
Dynatrace does not 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.
Retrieve the current privacy settings:
import 'package:dynatrace_flutter_plugin/dynatrace_flutter_plugin.dart';Future<void> checkPrivacySettings() async {final options = await Dynatrace().getUserPrivacyOptions();print('Data collection level: ${options.dataCollectionLevel}');print('Crash reporting enabled: ${options.crashReportingOptedIn}');}
Set the user's privacy preferences:
import 'package:dynatrace_flutter_plugin/dynatrace_flutter_plugin.dart';// Grant full consentDynatrace().applyUserPrivacyOptions(UserPrivacyOptions(DataCollectionLevel.UserBehavior, true));// Grant performance monitoring only, no crash reportingDynatrace().applyUserPrivacyOptions(UserPrivacyOptions(DataCollectionLevel.Performance, false));// Revoke all consentDynatrace().applyUserPrivacyOptions(UserPrivacyOptions(DataCollectionLevel.Off, false));
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.
When submitting your app to the App Store or Google Play, you may need to complete a privacy questionnaire. For information on what data OneAgent captures, see: