Install the New Relic Browser agent

New Relic Browser uses a JavaScript snippet (or "agent") to instrument your app's webpages. The JavaScript collects data for browser monitoring. To install the New Relic Browser agent, you can choose from a number of deployment options.

Select a deployment option

No matter which option you use to deploy New Relic Browser, the end result is to inject the Browser agent's JavaScript snippet into your pages for browser monitoring. The method you select depends on your preferences and business needs. You can also use the Browser Application settings page to update settings.

New Relic Browser deployment option Description
Use the APM agent to inject the JavaScript You can use an APM agent to automatically inject the browser monitoring JavaScript snippet for you. This is the easiest way to install the agent for an app that already is being monitored by New Relic APM. (APM-monitored apps are listed on your New Relic APM Applications index.)
Paste the JavaScript snippet into a webpage

This allows you to control the exact placement of the JavaScript into your app's webpage(s) by copying and pasting the New Relic Browser agent's JavaScript snippet. This is useful for:

  • Standalone apps, static sites, and cached pages delivered by CDN
  • APM apps that are not as closely coupled to the browser app as with a standard server-side app (for example, when your client-side app talks to a REST API back end)
Enable single-page app (SPA) monitoring

Enabling SPA requires a Pro + SPA subscription, and you may need to re-deploy the Browser JavaScript agent.

Use the REST API

The New Relic REST API lets you manage deployment outside the New Relic Browser UI. This is useful for large organizations deploying multiple apps.

Use an APM agent API to manually instrument the JavaScript snippet

For apps that are monitored by New Relic APM, you can use the APM agent's API to inject the JavaScript manually instead of automatically.

Enable an APM-monitored app

Use this procedure to automatically deploy the Browser agent on an app that is monitored by New Relic APM:

  1. Go to rpm.newrelic.com/browser > Add more.
  2. From the New Relic Browser deployment page, select Enable via New Relic APM.
  3. Select your choice of available options for Browser agent instrumentation features, based on your New Relic subscription level.
  4. Type or use the search window to find the app's name.
  5. Select Enable.

    Node.js: To finish enabling the Browser agent for a Node.js app, follow the additional procedure to insert the JavaScript header into the beginning of your HTML page's head tag.

  6. Generate some traffic for your app.
  7. Wait a few minutes for New Relic Browser to start collecting data, then select your app from the Browser applications index.

Enable with copy/paste

Use this procedure to insert New Relic Browser's JavaScript snippet for browser monitoring into your app's webpages yourself. This option is useful for monitoring static sites (such as Jekyll) or cached pages delivered by CDN.

Near the bottom of the generated JavaScript is your New Relic Browser license key and application ID. This is useful with the New Relic REST API and API Explorer.

  1. Go to rpm.newrelic.com/browser > Add more.
  2. From the New Relic Browser deployment page, select Copy/Paste JavaScript Code.
  3. Select your choice of available options for Browser agent instrumentation features, based on your New Relic subscription level.
  4. Name your app:

    • If your app is monitored by New Relic APM, select Yes, then type or use the search window to find the app's name.
    • If you have a standalone app for New Relic Browser (not monitored by New Relic APM), select No, then type the app's name.
  5. Select Generate snippet.
  6. Copy the code snippet that automatically appears, then paste it inline into your pages as close to the top of the <head> element as possible, but after any position-sensitive <meta> tags (for example, X-UA-Compatible or charset information). For more information on the inline head placement, see JavaScript placement requirements.
  7. Generate some traffic for your app.
  8. Wait a few minutes for New Relic Browser to start collecting data, then select your app from the Browser applications index.

If you use the copy/paste method but do not finish the setup process, you can still view and copy the generated JavaScript snippet from your app's Browser Application settings page or by using the New Relic REST API (v2).

Instrument webpages using the APM agent

This information applies to apps that are also monitored by New Relic APM.

New Relic's agents can instrument webpages with the required JavaScript for page load timing. If you use the New Relic APM agent to add the JavaScript snippet to your webpages, insert the instrumentation snippet as close to the top as possible. This allows you to take advantage of detailed information about New Relic Browser's AJAX calls and JavaScript errors.

For more information, see the instructions for your agent:

Troubleshoot Browser agent installation

When you enable Browser Pro features for session traces, AJAX calls, or JavaScript errors, it may take approximately five minutes before information becomes available. If you have problems with your Browser installation or if no data appears after five minutes, refer to the troubleshooting tips, and restart your agent.

For more help

Recommendations for learning more: