• EnglishEspañol日本語한국어Português
  • Log inStart now

start

Syntax

newrelic.start()

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. When called, the method will start all features that have been deferred. See Feature names for a list of feature names which can be started in a deferred state.

Feature Names

  • ajax

  • jserrors

  • metrics

  • page_action

  • page_view_event

  • page_view_timing

  • session_replay

  • session_trace

  • spa

    Important

    The response body of the page_view_event harvest contains critical information for running the other features. Deferring the start of page_view_event will cause all other features to wait until .start() is called.

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 state
NREUM.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" all deferred features

newrelic.start()
// all deferred features in the agent will now start harvesting
Copyright © 2024 New Relic Inc.

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