Search...
getCurrentConsentPolicy( )
Gets the visitor's consent policy regarding allowed cookies and 3rd-party data transfer, such as for GDPR or CCPA purposes.
Description
The getCurrentConsentPolicy()
function returns the
consent policy details of the visitor, meaning, which cookies the visitor allows and whether data transfer
to 3rd parties is allowed.
Authorization
Request
This endpoint does not take any parameters
Response Object
NAME
TYPE
DESCRIPTION
defaultPolicy
boolean
Whether the policy is the default consent policy set by the site owner. If true
, either the user has not set a policy or the site owner has reset the policy.
policy
Policy
An object representing the user's current consent policy.
createdDate
Date
If a cookie exists in the browser defining the current consent policy, the date the policy was set. Otherwise, undefined.
Status/Error Codes
Was this helpful?
Get a members's consent policy
Copy Code
1import { consentPolicy } from 'wix-window-frontend';23// ...45const policyDetails = consentPolicy.getCurrentConsentPolicy();6const policy = policyDetails.policy;78/* policyDetails value:9 *10 * {11 * "defaultPolicy" : true,12 * "policy" : {13 * "essential" : true,14 * "functional" : true,15 * "analytics" : true,16 * "advertising" : true,17 * "dataToThirdParty" : true18 * },19 * "createdDate" : 2020-07-20T12:33:09.775Z20 * }21 */