Examples
Read TC Data
With the addEventListener command, you can register a listener to the CMP that will be called with the TC Data whenever an event occurs. When adding a listener, the callback is called immediately with the current TC Data as well as a listenerId that you must store if you need to remove the listener.
window.__tcfapi("addEventListener", 2, function (tcData, success) {
if (success && tcData && (tcData.eventStatus == "cmpuiclosed" || tcData.eventStatus == "tcloaded")) {
if (!tcData.gdprApplies) {
console.log("GDPR doesn't apply to user");
} else {
if (tcData.vendor.consents[53] && tcData.purpose.consents[1]) {
console.log("Vendor ID 53 has consent for purpose ID 1");
}
if (!tcData.vendor.consents[53] || !tcData.purpose.consents[2]) {
console.log("Vendor ID 53 has no consent for purpose ID 2");
}
if (tcData.vendor.legitimateInterests[53] && tcData.purpose.legitimateInterests[9]) {
console.log("User has been informed of vendor ID 53's legitimate interest for purpose ID 9 and hasn't objected to it");
}
if (!tcData.vendor.legitimateInterests[53] || !tcData.purpose.legitimateInterests[10]) {
console.log("User has objected to vendor ID 53's legitimate interest for purpose ID 10");
}
}
}
});You can specify a list of vendor IDs for which the TC Data is requested.
Read the Global Vendor List
The Global Vendor List containing the purposes and vendors participating in the Transparency & Consent Framework can be retrieved with the getVendorList command.
You can specify a vendorListVersion for which the Global Vendor List is requested.
Revoke Utiq Consent
If the user has revoked their consent for Utiq outside of the CMP, you can set the choice status via the CMP API using the following command:
Mis à jour
Ce contenu vous a-t-il été utile ?
