> ## Documentation Index
> Fetch the complete documentation index at: https://developers.hubspot.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

---
id: aba25423-7453-43a5-b608-649a2862079c
---

# Add privacy consent listener

Check the consent status of the visitor when using the [consent banner](/docs/api-reference/latest/account/settings/consent-banner/consent-banner-api).

## Usage

```javascript theme={null}
var _hsq = (window._hsq = window._hsq || []);
_hsq.push([
  "addPrivacyConsentListener",
  function (consent) {
    // Handle consent status
    if (consent.allowed) {
      console.log("Consent granted");
      // Enable additional tracking or analytics
    } else {
      console.log("Consent denied");
      // Disable additional tracking
    }
  },
]);
```

## Parameters

The callback function receives a consent object with information about the visitor's consent status:

* `allowed` (boolean): Whether the visitor has granted consent.
* Additional properties may be available depending on the consent banner configuration.

## Use Cases

* Conditionally enable third-party analytics based on consent.
* Show/hide certain features that require tracking.
* Customize user experience based on privacy preferences.
* Comply with GDPR and other privacy regulations.
