Go Headless

Changelog

SDK
Articles
Get Started
Work with the SDK
Set up a Client
Use the Wix MCP

Core Modules
About Core Modules
sdk
essentials
web-methods

Host Modules
About Host Modules
dashboard
editor
site
Introduction
Analytics
Events
Consent Policy Manager
Introduction
getCurrentConsentPolicy()
onConsentPolicyChanged()
resetConsentPolicy()
setConsentPolicy()

Business Solutions
About Business Solutions
ai-site-chat
blog
bookings
cache
crm
data
ecom
events
restaurants
stores
realtime

Frontend Modules
About Frontend Modules
bookings
crm
ecom
events
location
members
mobile
navigate-mobile
pay
pricing-plans
seo
site
storage
stores
window
site-realtime

setConsentPolicy( )


Sets the current site visitor's consent policy regarding allowed cookies and data transfer to 3rd parties, such as for GDPR or CCPA purposes.

Changes to the consent policy take affect after the page is refreshed.

Method Declaration
Copy
Method Parameters
policyPolicyRequired

An object representing the cookies of the site visitor's consent policy.


successCallbackfunction

successCallback(policyDetails: PolicyDetails): void Optional callback function called on success with PolicyDetails


errorCallbackfunction

errorCallback(errorData: string): void Optional callback function called on error with error message

Returns
Return Type:Promise<PolicyDetails>
Errors

This method doesn't return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?