This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Updates a site's default consent policy.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function updateConsentPolicy(consentPolicy: ConsentPolicy): Promise<void>;
Default consent policy defined by the Wix user. Can be further limited by site visitors.
elevate()
, which enables site visitors to call functions without the required permissions. Exercise caution when using elevate()
to prevent security vulnerabilities.import { siteProperties } from "wix-business-tools.v2";
import { elevate } from "wix-auth";
/* Sample objectArg value:
* {
* advertising: true,
* analytics: true,
* dataToThirdParty: true,
* essential: true,
* functional: true
* }
*/
export async function myUpdateConsentPolicyFunction(consentPolicy) {
try {
const elevatedUpdateConsentPolicy = elevate(
siteProperties.updateConsentPolicy,
);
await elevatedUpdateConsentPolicy(consentPolicy);
console.log("Success! Updated policy");
return true;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to void */
There is 1 error with this status code.
There is 1 error with this status code.
This method may also return standard errors. Learn more about standard Wix errors.