• /
  • EnglishEspañol日本語한국어Português
  • 로그인지금 시작하기

Browser monitoring and the Node.js agent

With the Node.js agent, you can add browser instrumentation to your web pages. To use with your Node.js agent, ensure you have the latest release of the Node.js agent.

To enable browser monitoring in the user interface, follow the procedures to install the browser agent. Then follow the procedures in this section to set up the Node.js agent.

Insert the JavaScript header

Instrumentation for the Node.js agent can continue beyond your application into end users' browsers. The newrelic module can generate script headers which, when inserted into your HTML templates, will capture the end users' page load times. The headers must be manually injected, but no extra configuration is necessary.

  1. At the beginning of your html page's head tag, insert the results of newrelic.getBrowserTimingHeader() after any CHARSET meta tags.

    Exception: For maximum Internet Explorer compatibility, insert the results of newrelic.getBrowserTimingHeader() after any X-UA-COMPATIBLE HTTP-EQUIV meta tags.

  2. Call the header once for every request. Do not cache the header.

Generating headers is fast, and it does not require your application to make extra requests to New Relic.

Framework examples

Here are some examples of how to set up browser monitoring with different frameworks and templates.

Disable header generation

By default, calls to newrelic.getBrowserTimingHeader() should return valid headers. To disable header generation without removing your template code: In your newrelic.js file, add:

browser_monitoring : {
enable : false
}

You can also set the environment variable NEW_RELIC_BROWSER_MONITOR_ENABLE=false.

주의

Always leave ssl between the agent and the New Relic collector when using browser monitoring.

You can safely leave the API calls in place even if you are not using browser monitoring or the newrelic module.

  • If browser monitoring is disabled, or if there is an error so that working headers cannot be generated, the newrelic module generates an innocuous HTML comment.
  • If you disable the newrelic module completely, no content will be generated.
Copyright © 2024 New Relic Inc.

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