consent.onUpdate
Method to subscribe to TrustCommander consent updates OnSite via JavaScript.
cact('consent.onUpdate', function (result) { ... })Examples
Example to react to consent changes of a specific category
cact('consent.onUpdate', function (result) {
const ANALYTICS_ID = 2;
const analyticsCategory = result.consent.categories[ANALYTICS_ID] || {};
if (analyticsCategory.status === 'on') {
// Consent was provided for the category.
} else {
// Consent was not provided for the category.
}
});Example only react to consent changes of a specific category after the initial consent was given
Last updated