What does this feature do?
This allows for the integration of privacy policy opt-ins for your users on how web applications collect, transmit, and process data monitored by the browser agent. By enabling this feature, you can let users decide whether to consent to allow the browser agent to send data over the network.
A new property is available in the browser agent’s init object called browser_consent_mode. This setting controls whether to use the consent mode in the agent. Available in the Browser Lite, Browser Pro or Pro + SPA agent, version 1.303.0 or greater.
How do I use it?
To use this feature, you will need to visit your app settings page and turn the "Turn on consent" toggle to on. This setting is off by default.
NerdGraph can be used as an alternative to turn the setting on and off. To do so, run a mutation query on the browserSettings graphQL object for the browser_consent_mode property, setting enabled to true or false.
Once you have a privacy policy or opt-in modal integrated with your web application, then if a user clicks one of the following:
“Yes, I consent.”
You will need to invoke use of a new API called
consent(accept?: boolean). When calling the consent() API, the accept parameter is true by default.Browser features with autoStart: true will send data to New Relic after consent is provided.
Browser features with autoStart: false will need to be invoked using the start() API function to start deferred agent features to send data over the network.
“No, I do not consent.”
Since the default is true, you will need to call
consent(false), taking note of the false argument. The agent will not send data over the network for that user.browser_consent_mode
consent() API
Outcome
Off (default)
n/a
Browser data is collected by New Relic
On
Called with
consent()or called withconsent(true)(default)Browser data is collected by New Relic
On
Called with
consent(false)Browser data is not collected by New Relic
On
Not called
Browser data is not collected by New Relic
Additional considerations
When
browser_consent_modeis enabled, up to ~30 seconds and a maximum of 1MB of data will be buffered in the end user’s browser and not sent to New Relic until the user selects consent and the consent API is called. Because of these constraints, it is possible that some data will be dropped and not sent to New Relic when the consent API is invoked.If session storage is enabled, decisions passed into the consent API will persist across pages.
If session storage is disabled, the consent API will need to be called on every page load.