Configurable events

Cookie Consent has a few javascript events that can be used to extend the functionality. Here's a list of all available events:

<script src="https://cookie.consent.is/cc/xxxxxxx.js"></script>
<script type="text/javascript">
window.addEventListener("load", function() {
window.cookieconsent.initialise({
// Called when the widget has been initialized and rendered.
// When using geolocation this method is always called when loading a page.
onInitialise: function(status) {
if (this.hasConsented('analytics')) {
}
},
// Called when user allows or denies any category
onStatusChange: function(status, previousStatus)
{
if (this.hasConsented("analytics"))
{
}
},
// Called when user allows a category
// The category parameter contains the name of the category
// being allowed.
onAllow: function(category) {
if (category == 'analytics') {
}
},
// Called when user denies/revokes a category
// The category parameter contains the name of the category
// being denied/revoked.
onRevoke: function(category) {
if (category == 'analytics') {
}
}
})
});
// Structure of the status parameter
var status = {
answered: false, // true if user has already consented (either by allowing all or denying all or some categories)
dnt: false, // true if the browser did send the do-not-track header
gdpr: true, // true if the user is located in any of the countries where GDPR applys
categories: [ // Array of cookie categories
{
changeable: true, // true if the user is able to allow/deny this category
default: false, // The default value if user has not consented
tracking: true, // true if this category contains tracking cookies
id: 'analytics', // The identifier for this categories, used for the JavaScript API
header: 'Analytical cookies', // Display name of the category
message: 'Analytical cookies help us improve our website by collecting and reporting information on its usage.' // Description of the category
}
]
};
</script>