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

This product reached the end of support date on March 31, 2021.

Android instrumentation for Webview

hrafn_thorvalds
Newcomer

Hi,

We currently have Dynatrace setup for our Android client, and everything seems to be working correctly. Our client has some functionality that we display inside of a Webview though (AngularJS code) and we never see any details on what is happening inside there.

I see that based on the documentation Dynatrace has support for Android's WebView, but I am unable however to figure out what is required to have Dynatrace auto instrument the WebView (if that is possible).

Do we need to add JS instrumentation to the AngularJS code or is there some way we can hook Dynatrace into the webview?


Sincerely

Hrafn


6 REPLIES 6

JS agent should be injected there. This means that part of user actions will be visible in regular mobile application in Dynatrace, part in Web applications. If you are using Apache Cordova you can use Cordova plugin for OneAgent, if not you have manually inject js tag from dynatrace. Just create new application, add there support for angular and other technologies you are using and add generated tag to your application. I think agentless rum monitoring will be need here. But as an know this will consume 2 visits for users that are visiting webpart as well, one for mobile and one for web.

Sebastian


Hi Sebastian,

Thank you for the answer.

We will look into manually injecting the tags into the Javascript layer.


matthias_hochri
Dynatrace Pro
Dynatrace Pro

Be aware that Angular transitions are not captured by the JSAgent. So if you go through the router and navigate to different pages, the JSAgent will not capture those things, as it only capture user actions that contain a web requests. As Sebastian already said the Cordova plugin (If you use Ionic or Cordova on Top) would offer you a manual API - so you could at least instrument them manually.


Hi Matthias,

Thank you for the answer.

Just for clarification, as I am not a specialist in Angular, when you say that the JSAgent would only capture user actions that contain a web request do you know if that would also work if the user actions trigger a local page load?
All the pages we have are served up locally, so there are no web requests per say for fetching them (however the content on display is fetched over the network).

Sadly we are using a framework called Backbase that Dynatrace doesn't seem to support specifically.


Web requests means loading content from remote serwer. Your angular should fetch data from external API ang making xhr calls. Such actions are recorded by JS agent. But when page will switch to new one without API calls you will not see it.


let me append something here.

per default, the js agent _does_ capture page loads, even if they are loaded from a local source. with page load i don't mean a route redirect, but a full page load (including beforeunload and load events).

if you do some manual instrumentation, you can also make the jsagent capture route redirects. whenever you change a route, you can use the dtrum api to create an action. if you go to settings->web & mobile monitoring->advanced setup. there's a section called "add custom user actions" and below a download link that includes documentation and samples for the dtrum api.

in short, capturing route redirects as actions can be as simple as this:

var actionId = dtrum.enterAction("some-target-route", "route redirect");
// then, when the route is loaded (or whenever you determine that action as finished):
dtrum.leaveAction(actionId);