New Relic Browser and the Java agent

New Relic Browser 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 enable Browser in the user interface, 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.

Before you enable New Relic Browser for use with the Java agent, make sure you are using the latest version of the Java agent.

Instrument Browser using Java agent API

If your framework does not allow you to enable New Relic Browser from the UI, with the copy/paste method, or by using the REST API, you can manually instrument New Relic Browser by using the Java agent API.

Disable auto-instrumentation.

Disable auto-instrumentation on all pages

Set the auto_instrument flag under browser_monitoring to false in your newrelic.yml.

browser_monitoring:
auto_instrument: false

Restart your application.

Flush the app server's work cache.

Flushing the work cache forces the app server to recompile JSPs, which is when auto-instrumentation occurs.

Disable auto-instrumentation only on specific pages

Use the disabled_auto_pages flag under the browser_monitoring stanza. For example, to disable auto-instrumentation on testpage_1.jsp and testpage_2.jsp, use the following:

To ensure that all of your Browser page views are not grouped under a single /velocity transaction (and to avoid metric grouping issues), disable your enable_auto_transaction_naming setting in your newrelic.yml file:

enable_auto_transaction_naming: false

Add newrelic-api.jar to the classpath of Tomcat, typically in .../tomcat/bin/setenv.sh:

CLASSPATH=$CLASSPATH:/opt/newrelic/newrelic-api.jar

OR

Add the reference to this jar file to the end of an existing CLASSPATH=... line within that file.