Adjust OneAgent configuration via Dynatrace Android Gradle plugin
The following configuration options can be used to modify the default configuration of the OneAgent. They are especially useful when used along with the auto-start injection feature.
They can also be used to adjust the OneAgent configuration when the manual startup approach is approached. In this case, you have to be careful because these settings might get overridden with the ConfigurationBuilder
.
Data privacy
With the user opt-in mode for mobile apps, you can dynamically adjust data privacy settings and build your apps in compliance with data protection laws and regulations.
To activate the user opt-in mode (when you use the auto-start injection feature), enable the userOptIn
property.
dynatrace {
configurations {
sampleConfig {
userOptIn true
}
}
}
configure<com.dynatrace.tools.android.dsl.DynatraceExtension> {
configurations {
create("sampleConfig") {
userOptIn(true)
}
}
}
Use the OneAgent SDK to adjust the data privacy level based on user discretion.
Hybrid apps that use RUM JavaScript inside WebView
For hybrid apps that use the RUM JavaScript, cookies must be set for each instrumented domain or server the app communicates with. When the hybrid app monitoring feature is enabled, OneAgent generates these cookies for every specified domain and stores them into the CookieManager
.
All hybrid app monitoring related properties are part of HybridWebView DSL and must be configured via the hybridWebView
block:
dynatrace {
configurations {
sampleConfig {
hybridWebView {
enabled true
domains '<domain1>', '<domain2>'
domains '<anotherDomain>'
}
}
}
}
configure<com.dynatrace.tools.android.dsl.DynatraceExtension> {
configurations {
create("sampleConfig") {
hybridWebView {
enabled(true)
domains("<domain1>", "<domain2>")
domains("<anotherDomain>")
}
}
}
}
You can activate the hybrid app monitoring feature with the enabled
property. All used domains, hosts, and IP addresses must be specified via the domains or the httpsDomains property. Domains and sub-domains must start with a dot (.
).
Dynatrace allows you to add the Secure
cookie attribute for all cookies that are set by Dynatrace. This ensures that the browser sends these cookies only over secure connections.
dynatrace {
configurations {
sampleConfig {
hybridWebView {
enabled true
httpsDomains 'https://<domain1>', 'https://<domain2>'
httpsDomains 'https://<anotherDomain>'
}
}
}
}
configure<com.dynatrace.tools.android.dsl.DynatraceExtension> {
configurations {
create("sampleConfig") {
hybridWebView {
enabled(true)
httpsDomains("https://<domain1>", "https://<domain2>")
httpsDomains("https://<anotherDomain>")
}
}
}
}
Adjust OneAgent behavior
OneAgent allows you to enable client-side load balancing that helps avoid unbalanced load on the server when multiple OneAgents simultaneously establish a connection to the ActiveGate.
dynatrace {
configurations {
sampleConfig {
agentBehavior {
startupLoadBalancing true
}
}
}
}
configure<com.dynatrace.tools.android.dsl.DynatraceExtension> {
configurations {
create("sampleConfig") {
agentBehavior {
startupLoadBalancing(true)
}
}
}
}