---
title: consent
source: https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/consent
---

## Syntax

```js
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](https://docs.newrelic.com/docs/browser/new-relic-browser/configuration/consent-mode).

## Parameters [#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

### A user accepts consent for the browser agent to harvest data

```js
newrelic.consent()
```

### A user rejects consent for the browser agent to harvest data

```js
newrelic.consent(false)
```
