• /
  • EnglishEspañolFrançais日本語한국어Português
  • Log inStart now

consent

Syntax

newrelic.consent(accept?: boolean)

Allows or rejects consent for the browser agent to send data over the network.

Requirements

  • Browser Lite, Pro, or Pro+SPA agent (v1.303.0 or higher)

Description

The browser agent has optional consent mode functionality. When consent mode is enabled through app settings or with NerdGraph, users can call the newrelic.consent(...) method to allow or deny consent on whether or not data is sent over the network.

For more information on configuration and usage, see our docs on consent mode.

Parameters

Parameter

Description

$accept

boolean

Optional. Allows or rejects consent for the browser agent. The accept parameter is true by default.

Use Cases

  • You want to wait to harvest data until a user has consented with a modal on your site

Examples

newrelic.consent()
newrelic.consent(false)
Copyright © 2025 New Relic Inc.

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