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 .NET MAUI NuGet package 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:
OffPerformanceUserBehaviorUser 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, update your dynatrace.config.json file:
{"android": {"userOptIn": true},"ios": {"DTXUserOptIn": true}}
You can retrieve the data privacy preferences of a particular user.
To get the current UserPrivacyOptions configuration, use the following API call:
using Dynatrace.MAUI;// Get the UserPrivacyOptions objectUserPrivacyOptions currentOptions = Agent.Instance.GetUserPrivacyOptions();// Get the individual settings for DataCollectionLevel and crash reportingbool crashOptedIn = Agent.Instance.GetUserPrivacyOptions().CrashReportingOptedIn;DataCollectionLevel dataCollectionLevel = Agent.Instance.GetUserPrivacyOptions().DataCollectionLevel;
You can adjust the data privacy preferences based on the decision of a particular user.
To set new options on a UserPrivacyOptions object, use the following code:
using Dynatrace.MAUI;// Creating a new UserPrivacyOptions object requires setting the two parameters of DataCollectionLevel and crash reportingUserPrivacyOptions options = new UserPrivacyOptions(DataCollectionLevel.Performance, false);// Update the options with the setter// Set a data collection level (user allowed you to capture performance and personal data)options.DataCollectionLevel = DataCollectionLevel.UserBehavior;// Allow crash reporting (user allowed you to collect information on crashes)options.CrashReportingOptedIn = true;// Get the values of the configuration with the getteroptions.DataCollectionLevel;options.CrashReportingOptedIn;// Get the UserPrivacyOptions objectUserPrivacyOptions currentOptions = Agent.Instance.GetUserPrivacyOptions();
To apply the new UserPrivacyOptions configuration, use this code:
using Dynatrace.MAUI;UserPrivacyOptions options = new UserPrivacyOptions(DataCollectionLevel.UserBehavior, true);Agent.Instance.ApplyUserPrivacyOptions(options);
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: