cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Best Practices: Mobile Application Instrumentation

theharithsa
Dynatrace Champion
Dynatrace Champion

User Tagging:

  • Tagging a user in mobile instrumentation needs to be done correctly to capture each session so, the best way to do it is adding the tag in 3 places.
  • One, at the start of the application (Splash Screen) with the device ID. This will capture and name the session with device ID.
  • Two, once user is logged in and homepage comes, tag a user at that part, and send it to Dynatrace. This time user tag would be username, email, or a unique ID which you want to pass.
  • Third, make sure you are not passing any user tag from anywhere even after logging out from the application because, Dynatrace tags the session with the tag that is passed at last.
  • These steps can be applied for both iOS and Android.

Auto/Manual Instrumentation:

  • Auto Instrumentation is an easy way to capture every touch that user performs with the application. Dynatrace auto-instruments every touch by default.
  • Network requests are also captured automatically, and the user action naming of each user action is done like this,
    • If it is a button, this will take the text that is there in the view and name the user action as “Touch on Button Name”
    • If there is no text is specified in the view/button, Dynatrace auto-instrumentor takes the name of the parent layout like Relative, Linear or Constraint Layout as “Touch on Relative Layout:”
    • In iOS it takes the name of respective view layouts.
  • To overcome this, we need to manually instrument the user action and give names that are easy for us to Identify.
    • We could try adding user action naming rule in Dynatrace if the action detected is unique but if it is not unique and is naming different actions with the same name, we should go for manually adding user actions.
  • Synchronous Calls: Dynatrace Auto-Instrumentor captures network requests automatically and map it under current user action. If there are multiple synchronous calls are involved, it will not be able to capture if the call is closed and another call is made. This is true in some cases and in some cases Dynatrace auto-instrumentor will capture. If calls are async, Dynatrace will capture complete network requests.

Crash Analytics:

  • Dynatrace auto-instrumentation detects the crashes automatically. For iOS and Android, it captures the crashes and report it to Dynatrace portal.
  • This can be enhanced more and get the code level data by uploading symbolic files for both iOS and in Android.

Alerts:

  • When it comes to alerting, Dynatrace automatically uses its AI capabilities to notify problems or the crashes that occurs in the mobile application
  • Anyhow, you can integrate those alerts so that it will notify you via Emails, Slack, Trello, OpsGenie, SNOW and many other Incident Management Systems.
Love more, hate less; Technology for all, together we grow.
4 REPLIES 4

Shamila
Newcomer

Hi, I have setup Dynatrace auto-instrumentation on an Android mobile app. I can see some limited button presses and few network connections have been made in the mobile app. But it doesn't show complete user actions(button clicks) or all the network connections app makes. 

Below is what I have in the main build.gradle file.

Do I need to add anything else in the config to enable full capture of button clicks and network calls?

 

apply plugin: 'com.dynatrace.instrumentation'
dynatrace {
configurations {
sampleConfig {
autoStart {
applicationId 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
beaconUrl 'https://xxxxxxxxxx.xx.dynatrace.com/mbeacon'
}
userOptIn false
agentBehavior.startupLoadBalancing true
sessionReplay.enabled false
}
}
}

@Shamila it depends on how your application is written, especially what UI toolkit are you using. For android auto-instrumentation of JetPack Compose is not (yet) supported. Also when it comes to network requests, they are likely captured, but not bound to user actions. Be sure to check the network tabs. If that's not your case, check if you are using supported library for auto-instrumentation here

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Shamila
Newcomer

Thanks. This android app uses standard Android buttons. It doesn't use JetPack Compose.

The problem is, it does sometimes record button and lifecycle actions. However, Dynatrace is not capturing all the button clicks/lifecycle changes.

Same with the network calls. Some calls are recorded but not all of them. HttpURLConnection is being used to make web requests, and it is supported by Dynatrace auto-instrumentation. But Dynatrace is not capturing all the web requests.

What does app need to do extra in the below config (the screen shot attached) to capture every button click, every life cycle changes and every web requests when app does auto-instrumentation? Is it missing anything in the below configs?

Capture.PNG


Please advise. Thanks.

paul_kapeller
Dynatrace Guide
Dynatrace Guide

@Shamila based on your screenshot everything seems fine. so nothing to add there in the first place.

 

there might be several reasons for your user actions and/or web requests not to be automatically tracked by our agent.

 

Some examples are part of this FAQ: https://www.dynatrace.com/support/help/how-to-use-dynatrace/real-user-monitoring/setup-and-configura...

 

Here you can find some info on sensors we are using to detect user actions: https://www.dynatrace.com/support/help/how-to-use-dynatrace/real-user-monitoring/setup-and-configura...

 

Hence there are also cases, which are not covered by auto-instrumentation.

Therefore, you can of course always use manual instrumentation (using OneAgent SDK for Android) in addition to auto-instrumentation to track specific user actions / define their labels etc. - some info here:
https://www.dynatrace.com/support/help/how-to-use-dynatrace/real-user-monitoring/setup-and-configura...

 

Hope this helps... if you require us to take a closer look into this and help out it's best to have a support ticket created.

 

Featured Posts