• /
  • EnglishEspañol日本語한국어Português
  • Inicia sesiónComenzar ahora

Instrument browser monitoring with Java agent API

The capability gives you visibility into how your users are interacting with your Java application by using a JavaScript snippet (or "agent") to instrument your app's webpages. To install the browser agent via the UI, follow the procedures to install the browser agent. For example, you can:

  • Enable an APM-monitored app.
  • Enable with the copy/paste method.
  • Enable by using the REST API.

You can also manually instrument your webpages by using the Java agent API, as explained in this document.

Use Java agent API

If your framework does not allow you to enable browser monitoring from our UI, with the copy/paste method, or by using our REST API, you can manually instrument monitoring for your webpages. To do this, use our Java agent API.

  1. Make sure you are using the latest Java agent version.

  2. Disable auto-instrumentation.

  3. Access the Java agent API class by adding newrelic-api.jar to your application class path.

  4. Add the com.newrelic.api.agent.NewRelic.getBrowserTimingHeader() method to enable time tracking. See below for procedures for specific frameworks.

    Find the appropriate methods based on the framework you are using:

  5. Check the log file to verify that the agent is instrumenting correctly. Set the log_level setting in newrelic.yml to log_level: finer and check for the following messages:

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.