Manage Scripts via Callbacks

There are two ways to manage your scripts:

Code Examples

The cc:onConsent event can be used to execute code based on user consent.

window.addEventListener("cc:onConsent", function (event) {
  if ( CookieConsent.acceptedCategory("analytics") ) {
    // "analytics" category enabled
  }
});

The cc:onChange event can be used to execute code when the user changes their consent.

window.addEventListener("cc:onChange", function (event) {
    var detail = event.detail;
    if ( detail.changedCategories.includes("analytics") ) {
        if ( CookieConsent.acceptedCategory("analytics") ) {
            // "analytics" category was just enabled
        }
        else {
            // "analytics" category was just disabled
        }
    }
});

Available categories

  • necessary: Essential cookies are necessary for features that are essential to your use of our site or services, such as account login, authentication, and site security.
  • analytics: Analytics cookies allow us to analyze your visits and actions so we can make our service better.
  • marketing: Marketing cookies make it possible to show you more relevant social media content and advertisements on our website and other platforms.
  • personalization: Personalization cookies help us to tailor the user experience based on your preferences. They remember the choices you make, such as language or region, and provide improved features.