Browser monitoring's JavaScript snippet introduces a nearly invisible impact on website performance and user perception of the time it takes a page to load. The JavaScript is included in a packet of webpage data that is sent anyway. In addition, it immediately begins monitoring for errors and events as the rest of the webpage executes. The negligible amount of overhead required to load the JavaScript results in a significant return of actionable data.
Overall impact
The JavaScript's overhead takes into consideration both the impact on the user and the impact on your systems' performance:
- User perception: Typically users cannot detect performance degradations on a website of less than 200ms. Browser's JavaScript adds less than 15ms in aggregated time per page load. This is split up over time, so at no point would a user be able to perceive any performance impact due to the JavaScript.
- Webserver and systems: Browser app monitoring occurs on the user's browser, not on the server. Processing time does not have an impact on your CPU consumption.
In addition, we take additional steps to minimize any potential impact on the apps and webpages being monitored. For example, the "loader" script is loaded synchronously in the <HEAD>
in order to ensure monitoring is enabled for the entire life cycle of the page. This script is included inline, which eliminates the need for another roundtrip network request to a content delivery network (CDN). The "loader" comes with the initial page load.
Later in the life cycle of the page, New Relic loads an additional monitoring script asynchronously. This script should not have any perceivable effect to the user and is included in the overall overhead of less than 15ms per page.
Network impact
Browser monitoring also minimizes network traffic for the end user by aggregating data locally (in the client) and sending it back to New Relic on load
, at periodic intervals, on unload
, or when data has been collected. (During the browser session's idle periods, transmissions may not be required.)
Browser agent scripts
The agent consists of two scripts. The first script is inserted inline into the HTML document. The second script is downloaded from the content delivery network (js-agent.newrelic.com) when the window load event happens. Find out about browser agent types here.
Script | Lite | Pro | Pro + SPA |
---|---|---|---|
Inline script size | 8.3 KB | 22 KB | 27 KB |
Downloaded script size | 27 KB | 27 KB | 38 KB |
Browser agent harvests
Data type | Lite | Pro | Pro + SPA | Harvest frequency |
---|---|---|---|---|
Page view metrics/events | yes | yes | yes | One call. Once the second script is downloaded, we immediately make the first harvest call, which generates page view metrics and the |
| yes | yes | yes | All agent types collect |
| no | yes | yes | First call when agent initializes; every 60 seconds after that. These calls, sent as metrics data, happen every 60 seconds because we include the Ajax calls that the agent itself makes. This information also applies to Ajax metrics. |
Ajax metrics | no | yes | yes | Sent together with JavaScript errors. |
Ajax events | no | yes | yes | Sent together with |
Session traces | no | yes | yes | First call when agent initializes; after that, every 10 seconds if there is data to send. Session traces send the most data, but they are heavily sampled. Only about 75 page views per hour get enabled to send session trace data. The agent sends data every 10 seconds if it has enough data to send. |
| no | yes | yes | First call is made when agent initializes; after that, every 30 seconds if there is data to send. |
| no | no | yes | Sent immediately when an interaction finishes. There will always be at least one interaction that represents the initial page load. Additional interactions are collected only if the URL changes (representing route change). Harvest frequency details for Ajax events apply here as well. |