Documentation

JavaScript API

The banner adds a small API on window.BerryCookie for your own code:

CallWhat it does
BerryCookie.hasConsent(category)true when the category is accepted (necessary always is).
BerryCookie.consentThe decision: { id, cats, act, ts, v }, or null before one.
BerryCookie.modeoptIn, optOut or none for this visitor.
BerryCookie.show()Opens the preferences.
BerryCookie.renew()Shows the banner again.
event berrycookie:consentOn window after every decision; event.detail is the decision.
// Has the visitor accepted statistics? if (window.BerryCookie?.hasConsent('statistics')) { startAnalytics(); } // React to every decision (accept, reject, change) window.addEventListener('berrycookie:consent', (event) => { console.log('Accepted categories:', event.detail.cats); });

Need help? [email protected]

Ready to put it on your website?

Install it with one line of code, the Google Tag Manager template or the WordPress plugin.

Free for one website, no card. Create an account, add and verify your site, then paste one line of code — about ten minutes.