The '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 additional monitoring scripts asynchronously. These scripts 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 at periodic intervals and on page lifecycle events load
, unload
, pageshow
, and pagehide
. (During the browser session's idle periods, transmissions may not be required.)
Browser agent scripts
The agent consists of multiple scripts to reduce the initial size of the "loader" and to support loading only the JavaScript necessary to support the agent features that are enabled. The first script, the "loader", is inserted inline into the HTML document. The remaining scripts are downloaded from the content delivery network (js-agent.newrelic.com) when the load
page lifecycle event happens. The number of scripts loaded is dependent upon the type of agent being use. Find out about browser agent types here.
Script | Lite | Pro | Pro + SPA |
---|---|---|---|
Inline script size | 10.2 kB | 15.5 kB | 17.5 kB |
Downloaded script size | 15.3 kB | 21 kB | 25.4 kB |
Sizes are based on minified scripts using gzip compression.
Browser agent harvests
Data type | Lite | Pro | Pro + SPA | Harvest frequency |
---|---|---|---|---|
PageView events | yes | yes | yes |
|
PageViewTiming events | yes | yes | yes |
|
JavaScriptError metrics | no | yes | yes |
|
Ajax metrics | no | yes | yes | Sent together with JavaScriptError metrics as timeslice data. |
AjaxRequest events | no | yes | yes |
|
Session traces | no | yes | yes | Session trace data is harvested after the |
Session replay | no | yes | yes | Session replay events are harvested when one of the following occurs:
|
PageAction events | no | yes | yes |
|
BrowserInteraction events | no | no | yes |
|