window.addEventListener("cc:onUpdate", function (event) {
var detail = event.detail;
/**
* detail.cookie
* detail.changedCategories
* detail.changedServices
*/
if (detail.changedCategories.includes("analytics")) {
if (CookieConsent.acceptedCategory("analytics")) {
// "analytics" category was just enabled
} else {
// "analytics" category was just disabled
}
if (detail.changedServices["analytics"].includes("Google Analytics")) {
if (CookieConsent.acceptedService("Google Analytics", "analytics")) {
// "Google Analytics" service was just enabled
} else {
// "Google Analytics" service was just disabled
}
}
}
});