Set up agentless Real User Monitoring

Agentless monitoring is meant to be used in cases where you don't have access to your web server and therefore can't install OneAgent. However, before deciding on a third-party library, consider the following points: The full benefits of Real User Monitoring can be obtained only after you’ve installed Dynatrace OneAgent. The installation of Dynatrace OneAgent is highly recommended for the following reasons:

  • With agentless monitoring, need to manually insert a RUM JavaScript tag into each of your application’s pages, which can be challenging. Dynatrace OneAgent handles the insertion of all JavaScript tags for you.
  • Unless you use the code snippet option for agentless monitoring, the JavaScript tags embedded into your application’s pages won't be automatically updated when you change application monitoring settings. You’ll have to update the tags manually.

Performance impact

To minimize the impact on page-load time and your users’ first impressions of your application, you might want to load scripts as late as possible. Use blocking script tags to ensure that your JavaScript code will be executed exactly where you place it. If you need a script to run as early as possible, the execution can’t be postponed. One way to avoid these additional blocking requests during page load is to inline the script code. The script code needs to be inlined into each document, thereby propagating the data of a single cached file into every page of your application. By combining both these approaches, you can get an inline JavaScript snippet that performs the required initialization and defers loading of the big bulk of the code to a second script.

Standards and security policies

Certain development standards that are created to make applications more secure and faster also introduce new limitations. For example, the Content Security Policy (CSP) standard was introduced to minimize the chance of becoming a victim of cross-site scripting, thereby disallowing inline JavaScript code. This means that you have to use a simple JavaScript tag to inject the JavaScript code.

Another standard, the AMP project, aims to provide a framework that helps you build applications that are consistently fast across all devices and system platforms. In this case, self-developed and third-party JavaScript code aren’t allowed; only scripts provided by AMP can be used.

To monitor AMP applications with Dynatrace:

  1. In the navigation menu, click Deploy Dynatrace.
  2. Click the Setup agentless or AMP monitoring button.
  3. Turn the My application relies on Accelerated Mobile Pages (AMP) button on. AMP application monitoring

Maintenance effort

Agentless monitoring requires you to insert tags by yourself, which is why you must ensure that it requires as little manual effort as possible. You don’t want to have to change your code every time your configuration changes or when a new version is released. The code snippet added to your application usually doesn't need to be changed as it takes care of loading the right configuration and version for you.

Insertion methods

The right JavaScript tag insertion method depends upon the application and your requirements. There are five options to choose from, Code snippet async being the default option.

Insertion method Description
JavaScript tag Requires manual insertion of the RUM JavaScript tag into the HTML head of every application page. This approach is compliant with Content Security Policy. Depending on your configuration, the tag is updated periodically.
Code snippet (synchronously) Requires manual insertion of the code snippet into the HTML head of every application page. The snippet initializes Dynatrace and dynamically downloads the monitoring code into your application. The tag need not be updated.
Code snippet (deferred) Requires manual insertion of the code snippet into the HTML head of every application page. The snippet initializes Dynatraces and dynamically downloads the monitoring code into your application. This approach reduces impact on page load but reduces visibility because certain XHR calls may not be instrumented. The tag need not be updated.
OneAgent JavaScript tag Requires the same JavaScript tag that is inserted automatically by Dynatrace OneAgent. The tag must be updated each time the configuration is changed or monitoring code is updated.
Inline code Requires manual insertion of the full JavaScript code inline into the HTML head of every application page. The tag must be updated each time the configuration is changed or when new JavaScript code versions become available.

To select an agentless Real User Monitoring approach

  1. From the navigation menu, select Applications.
  2. Select the application that you want to configure.
  3. Click the () browse button and select Edit.
  4. From Application settings, select Setup.
  5. From the Insert monitoring code dropdown list, select an insertion method. insertion code options


Dynatrace offers a REST API that allows you to automatically retrieve the latest snippet for your application. You can automatically inject the latest script during the build time of your application.

All JavaScript tags are listed under REST API of the Agentless real user monitoring setup page. Rest API approach

Before you begin

What you'll need:

  • A custom JavaScript tag generated by Dynatrace.
  • Access to your application’s HTML source so that you can insert the JavaScript tag.
  • (Managed deployments only) A CDN to serve the RUM JavaScript tag that will prevent web page performance problems during Managed Server maintenance periods and/or local network outages.

Set up agentless monitoring