Consent Management is the process of informing customers about the data your business collects and how it is used, and giving them the ability to opt in or out. It's important for compliance with data privacy laws, like the General Data Protection Regulation (GDPR) and the California Consumer Privacy Act (CCPA).
We recommend using Segment’s Consent Manager on your website. The Consent Manager provides consent management for all integrations configured via Segment.
The Consent Manager is an add-on for Analytics.js. It includes a couple of variations:
- ConsentManager React component with pre-built UI
- ConsentManagerBuilder React component with custom UI
- Stand-alone script for non-React websites with pre-built UI
Segment describes its functionality:
"It works by taking control of the analytics.js load process to only load destinations that the user has consented to and not loading analytics.js at all if the user has opted out of everything. The user's tracking preferences are saved to a cookie and sent as an identify trait (if they haven't opted out of everything) so that you can also access them on the server-side and from destinations (warehouse)."
View the Github repo for complete installation instructions. Note that Segment's npm package @segment/analytics-next is not currently compatible with the Consent Manager, so you'll need to install Segment via snippet.
Two important things as you're getting started:
The Consent Manager controls the load process of Analytics.js, so you shouldn't have analytics.load anywhere in your website code. It's part of Segment's default code snippet, so you may need to delete it. Just remove the line analytics.load("YOUR_WRITE_KEY"). The Consent Manager will handle calling analytics.load.
Removing analytics.load("YOUR_WRITE_KEY") means Segment won't load without the Consent Manager, so be sure to include the Consent Manager on every page on your site.
Before getting started, verify you have integrations configured. In order for the Consent Manager to work, you must set up at least one Segment integration in your Segment workspace. Verify that your integrations (Google Analytics, Amplitude, etc.) are accessible by visiting the URL below. The response should not return an empty array if you have properly configured them: https://cdn.segment.com/v1/projects/<YOUR_WRITE_KEY>/integrations
View guides for implementing the Consent Manager in and .