Monitor End User Performance with Manual Browser Injection

You can monitor the experience of your user with your application without the use of an APM Agent.

Browser injection happens automatically if the APM Agent is configured accordingly, but can also be done manually. Manual injection should be used in the following scenarios:
  • When there is no APM Agent available for your application server or when you want to monitor static pages. In this case, manual injection will still allow you to see and alert based on page performance. You can see user sessions, and all instances of pages being visited.

  • Where automatic injection as performed by the APM Agent does not provide desirable results (for example, when you want a different injection location). In that case, configure the APM Agent for correlation mode. Along with manual injection, the complete functionality available with APM will be available.

If you configure your application to perform manual browser injection and an APM Agent is already present, then you can use one of the following options:
  1. Configure the Agent to perform correlation by setting oracle.apmaas.agent.browser.injectionType=correlation. This is the preferred option.

  2. Use no injection by setting oracle.apmaas.agent.browser.injectionType=none. However, this could result in navigation limitations.

The following sections describe how to configure and use manual injection.

Obtain the Collector URL

Before you can manually inject the Javascript, you need to obtain the Collector URL that will be used as part of the static script that will be injected.

  1. In the left navigation pane, click APM Admin and select Browser Agent.

  2. The Collector URL is listed in the Browser Agent screen.

To configure APM to use a different collectorUrl and to transfer data through reverse proxy, see Transferring EUM Data to OMC Collectors.

Check Browser Agent Rewrite Rules for Manual Injection

To check the default value for the Browser Agent Rewrite Rules, do the following:

  1. In the left navigation pane, click APM Admin and select Browser Agent.

  2. Scroll down to the Browser Agent Rewrite Rules section from the Browser Agent page to view the default value for the Browser Agent Rewrite Rules.

Manual Injection of APM Javascript Page Tag

In some environments it is not possible to use the automatic Javascript injection functionality to monitor end user performance of web pages. Static Javascript monitoring is useful for environments like Siebel, CDN, or when no agent is available for your application server platform.

In may application frameworks or content managements systems it will be sufficient to change a few page templates to change all application pages. In such cases, you can manually inject the APM Javascript page tag into your HTML to monitor end user page performance, without having the APM Agent installed.

When you use this option the page data cannot be correlated to specific server request data. Correlation to server requests is possible only if the agent is configured for correlation mode.

Note:

The details of where and how to manually inject the Javascript page tag are specific to the application, OS Platform and Application Server platform.

Insert the static Javascript manually in a HTML page:
  1. In the left navigation pane, click Administration and select Browser Agent.

  2. Copy the Javascript for agentless End User Monitoring provided in the right pane.

  3. Open the HTML page you want to set End User Monitoring for, in Page Source mode.

  4. Insert the copied script after the closing </head> tag. Ensure that you do not add the code within another <script> tag.

Insert the static Javascript manually in a PHP page:

If the web page to which you want to manually add the Javascript is a PHP page without HTML tags, add the EUM Javascript at the end of the PHP source code. Here is an example:

<?php 
phpinfo(); 
?>

<script>
window.apmeum || (apmeum = {});
apmeum.customerId='emaastesttenant1';
apmeum.baseCollectorUrl='https://abc1.example.com:4443/APMaaSCollector/external/collector?';
</script>
<script async crossorigin="anonymous" src="https://abc1.example.com:4443/APMaaSCollector/external/collector/staticlib/apmeum.js"></script>
To optimize performance for users of the monitored application an alternative CDN-backed location of the Javascript library can be specified as follows:
<script async crossorigin="anonymous" src="https://static.oracle.com/cdn/apm/1.47.0/apmeum.js"></script>

Parameters for Automatic Browser Injection

Here are the fields that are configured for browser injection during automatic injection:

Area Sample Initialization Default Value Description
Collector root oracle.apmaas.agent.collectorRoot=https://customer.itom2.management.pp1.oraclecloud.com/ Based on values received during provisioning of the agent. This is the basic collector url that is suffixed with APMaaSCollector/external/collector to get the collector url, and with APMaaSCollector/external/collector/staticlib/apmeum.js to get jsLibraryPath.
Collector URL oracle.apmaas.agent.collectorUrl=https://customer.itom2.management.pp1.oraclecloud.com/APMaaSCollector/external/collector? Based on collectorRoot (appending that with APMaaSCollector/external/collector) The default location to send observations to. If this is not set, it is initialized relative to collector Root.

Override this value only when using reverse-proxy.

Javascript Library URL oracle.apmaas.agent.jsLibraryUrl=https://customer.itom2.management.pp1.oraclecloud.com/APMaaSCollector/external/collector/staticlib/apmeum.js Relative to collector URL. Replace the ? with /staticlib/apmeum.js The injected reference .js file. This option should be used if you want to host the APM Javascript library locally for any reason.
Influence observations oracle.apmaas.agent.browser.setting="*(click:off), firefox(ajax:off, click:off)" *:on The APM Agent monitors observations that are enabled for the site. This can be configured globally or per browser.
Disable injection completely oracle.apmaas.agent.enableBrowserAgent=true true The goal is to continue monitoring data from the server-side only. If this option is combined with manual injected Javascript, the only missing part is the relation/correlation between browser side and server side monitoring.
Type of injection oracle.apmaas.agent.browser.injectionType="full" reference This allows customers to change the way the agent injects data. The available values are:
  • full for agents that allow full injection of Javascript

  • reference used to indicate injection with reference to the central library

  • correlation used to indicate injection using correlation information like adding operation ID into Response Cookie header.

Customer tenant ID oracle.apmaas.agent.tenant=fixedtenant   The tenant ID to use for reporting