Go Headless

/

SDK
Articles
Get Started
Work with the SDK
Set up a Client
Use the Wix MCP
What's New

Core Modules
About Core Modules
sdk
sdk-react (deprecated)
essentials
web-methods

Host Modules
About Host Modules
dashboard
dashboard-react (deprecated)
editor
site

Backend Modules
About Backend Modules
activity-counters
analytics
async-jobs
ai-site-chat
app-management
auth-management
automations
benefit-programs
billing
blog
bookings
business-tools
cache
calendar
captcha
categories
comments
consent-policy
crm
dashboard-management
data
data-extension-schemas
ecom
email-marketing
email-subscriptions
embeds
events
forms
forum
get-paid
groups
http-functions
identity
inbox
loyalty
marketing
marketing-consent
marketing-tags
media
members
moderation-rules
multilingual
notifications
payments
portfolio
pricing-plans
pro-gallery
redirects
reports
restaurants
reviews
search
secrets
stores
tags
urls
site-plugins
sender-details
sender-emails
realtime

Account Level Modules
About Account Level APIs
b2b-site-management
domains
resellers
user-management
sites

Frontend Modules
About Frontend Modules
bookings
crm
ecom
events
location
members
mobile
navigate-mobile
pay
pricing-plans
seo
site
storage
stores
window
Introduction
Setup
App Page Data
browserLocale()
copyToClipboard()
formFactor()
getAppPageData()
getBoundingRect()
getCurrentGeolocation()
getRouterData()
openLightbox()
openModal()
postMessage()
referrer()
scrollBy()
scrollTo()
trackEvent()
viewMode()
ConsentPolicy
Introduction
Setup
getCurrentConsentPolicy()
onConsentPolicyChanged()
resetConsentPolicy()
setConsentPolicy()
Lightbox
Multilingual
Rendering
WarmupData
site-realtime

onConsentPolicyChanged( )


Triggered when a site visitor's consent policy was changed using setConsentPolicy() or reset using resetConsentPolicy().

Use the onConsentPolicyChanged() method for code you want to run after the site visitor's current consent policy was changed using setConsentPolicy() or reset using resetConsentPolicy().

Usually, you want to call the onConsentPolicyChanged() method in the masterpage.js file so that the onConsentPolicyChanged() event handler runs no matter which page on your site is used to change the policy.

Method Declaration
Copy
Method Parameters
handlerfunctionRequired

handler(event: ConsentPolicyChangedEvent): void The name of the function or the function expression to run when the consent policy is changed.

Errors

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

Did this help?