Syntax
newrelic.start(value: string[]|undefined)
Browser API used to start agent features when running in a deferred state.
Requirements
- Browser Lite, Pro, or Pro+SPA agent (v1.239.0 or higher)
Important
The configuration required to use this API is not currently connected to the larger deployment system within New Relic. As such, calling this API will only have an effect in copy/paste or npm browser installations until further changes are made.
Description
Features can be loaded in a deferred
state, which can be controlled by setting the appropriate features' autoStart
property to false
in the configuration block NREUM.init.<feature>
used by the agent. This feature state means events will be observed and stored in the agent, but will not be harvested to NR1 until told to do so with the .start()
API method. See Feature Names for a list of feature names. See Examples for examples showing how to set features into a deferred state.
Upon executing this function with a valid value, the browser agent will start the relevant features that have been deferred by the autoStart: false
configuration. If called with no arguments, the method will start all features that have been deferred.
If called with a list of strings representing the feature names, the feature names matching the strings will be started. See Feature Names for a list of feature names.
Parameters
Parameter | Description |
---|---|
string[] OR undefined | Optional. An array of strings relating to a list of features to be started |
Feature Names
- ajax
- jserrors
- metrics
- page_action
- page_view_event
- page_view_timing
- session_replay
- session_trace
- spa
Use Cases
- You want to wait to harvest data until a user has consented with a modal on your site
- You wish to wait to harvest data until your site has set custom attributes
Examples
Loading all features in a deferred state (copy/paste, NPM)
// Change the init portion of the configuration block to add `autoStart: false` to any features desired to load in a deferred stateNREUM.init = { // feature configurations ajax: {autoStart: false}, jserrors: {autoStart: false}, metrics: {autoStart: false}, page_action: {autoStart: false}, page_view_event: {autoStart: false}, page_view_timing: {autoStart: false}, session_replay: {autoStart: false}, session_trace: {autoStart: false}, spa: {autoStart: false}, // other configurations // ...}
"Starting" a list of deferred features
newrelic.start(['ajax', 'jserrors', 'page_action'])// ajax, jserrors, and page_action features will now start harvesting
"Starting" all deferred features
newrelic.start()// all deferred features in the agent will now start harvesting