The JavaScript API
Once the ConsentBit script loads, a global ConsentBit object is available in the browser.
Common methods:
// Open the preferences panel
ConsentBit.openPreferences();
// Open the main banner (if it was dismissed)
ConsentBit.showBanner();
// Get the current consent state
const state = ConsentBit.getConsent();
// returns { necessary: true, preferences: false, analytics: true, marketing: false }
// Programmatically accept all categories
ConsentBit.acceptAll();
// Programmatically reject all non-essential
ConsentBit.rejectAll();
// Set specific categories
ConsentBit.setConsent({ analytics: true, marketing: false });
// Reset (forget) the visitor's choice , banner will reappear
ConsentBit.reset();
.png)
.png)




