Configure the Cookie Consent capability on an Experience Cloud site so non-essential cookies only run after a visitor agrees. This covers the high-level admin and developer steps; build the banner UI to match your brand.
- Turn on consent in Security and Privacy settings
In Setup, open the Security and Privacy area and enable cookie consent management for the org. Decide whether consent applies only to Required cookies or extends to Marketing, Preference, and Statistics categories.
- Build a Cookie Consent Lightning Web Component
Create an LWC that imports the lightning/userConsentCookie module. Add a toggle for each category and wire the controls to setCookieConsent so the visitor decision is stored in the CookieConsent cookie.
- Place the component on the site
In Experience Builder, add your consent component to the site so it appears on first visit. Confirm the CookieConsentPolicy and CookieConsent cookies are written after a choice is made.
- Gate non-essential cookies behind the decision
Before any marketing or statistics script runs, call isCategoryAllowedForCurrentConsent for its category. Only load the pixel or set the cookie when that category is allowed.
Whether consent covers only Required cookies or the full set of Marketing, Preference, and Statistics categories.
The four buckets (Required, Marketing, Preference, Statistics) that each cookie on the site maps to for consent decisions.
Whether you wire the banner to a third-party Consent Management Platform or keep the workflow fully inside Salesforce.
- Required cookies always run; do not try to gate the session cookie behind consent or you will break login.
- The banner UI is yours to build. Salesforce supplies the module and storage cookies, not a finished design.
- Map every cookie on the site to a category before launch, including custom cookies you set from Apex or LWC.