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

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
functions
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
rich-content
search
secrets
seo
stores
tags
urls
site-plugins
sender-details
sender-emails
editor-branches
realtime
faq
donations

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()
registerEventListener()
scrollBy()
scrollTo()
trackEvent()
viewMode()
ConsentPolicy
getCurrentConsentPolicy()
onConsentPolicyChanged()
resetConsentPolicy()
setConsentPolicy()
Lightbox
Multilingual
Rendering
WarmupData
site-realtime

setConsentPolicy( )


Deprecated

This method is deprecated.

Deprecated. This method will continue to work, but a newer version is available. Use the setConsentPolicy() method instead.

Migration Instructions

If this method is already in your code, it will continue to work. To stay compatible with future changes, migrate to setConsentPolicy().

To migrate to the new method:

  1. Add the new import statement:

    Copy
  2. If you plan to migrate all methods that use setConsentPolicy(), remove the original import { consentPolicy } from "wix-window-frontend"; statement.

  3. Look for any code that uses consentPolicy.setConsentPolicy(), and replace it with the new import. Update your code to work with the new setConsentPolicy() call and response properties.

  4. Test your changes to make sure your code behaves as expected.

Note: Check the new method documentation for any differences in parameters, return values, or behavior compared to the deprecated setConsentPolicy() method.

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

You can use the onConsentPolicyChanged() event to listen for changes made when a site visitor changes their consent policy with setConsentPolicy(). Handle the policy change accordingly in the event. 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.

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?