1. Cookie Consent
  2. Documentation

Disabling Cookies

How to disable cookies with Cookie Consent

Whenever you have chosen opt-in or opt-out as your compliance type, you will need to disable cookies on your site depending on the user action.

Disabling cookies should be done with the callback hook:
onInitialise: function (status) { var type = this.options.type; var didConsent = this.hasConsented(); if (type == 'opt-in' && didConsent) { // enable cookies } if (type == 'opt-out' && !didConsent) { // disable cookies } }, onStatusChange: function(status, chosenBefore) { var type = this.options.type; var didConsent = this.hasConsented(); if (type == 'opt-in' && didConsent) { // enable cookies } if (type == 'opt-out' && !didConsent) { // disable cookies } }, onRevokeChoice: function() { var type = this.options.type; if (type == 'opt-in') { // disable cookies } if (type == 'opt-out') { // enable cookies } }

Prefer not to maintain it?

Get consent that keeps itself up to date

Osano handles translations, geo-targeting, consent records and new laws, so you don't have to ship banner updates.