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 |
|---|---|
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
A user accepts consent for the browser agent to harvest data
newrelic.consent()A user rejects consent for the browser agent to harvest data
newrelic.consent(false)