Integrations
Use the JavaScript API (listen for consent changes)
Listen for consent changes and read consent state from your own code
The GetCookies script exposes window.GetCookies on every plan. Use it to run your own code only after consent, to build your own consent controls, or to react when a visitor changes their mind. The full reference is on the developers page.
The consent object
getConsent() returns null until the visitor has chosen, and then an object like this:
{
"id": "…",
"timestamp": "2026-10-25T09:14:02.000Z",
"categories": ["necessary", "analytics"],
"interaction": "custom",
"version": "…",
"expiry": 1792830842000
}categories lists the categories the visitor allowed: necessary, preferences, analytics and marketing.
Check consent on load
if (window.GetCookies?.hasConsent('marketing')) {
// safe to run marketing code
}Listen for a choice
window.GetCookies.on('consent', function (consent) {
if (consent.categories.includes('analytics')) {
// start analytics
}
});Events: consent (the visitor chose in the banner), consent-updated (your code called updateConsent) and loaded (the widget finished loading). The same events are dispatched on window as getcookies:consent, getcookies:consent-updated and getcookies:loaded. Remove a listener with off(event, callback).
Save a choice from your own UI
window.GetCookies.updateConsent(['analytics', 'preferences']);Pass an array of category ids, or an object of booleans:
window.GetCookies.updateConsent({ analytics: true, marketing: false });necessary is always added. The call returns a promise with the saved consent object and releases blocked scripts for the allowed categories. Any other argument, such as a string or an object with non-boolean values, rejects the promise with a TypeError and saves nothing.
Other methods
show()andhide()open or close the banner.reset()clears the stored choice and shows the banner again.getComplianceMode()returnsopt-in,opt-outornotice-onlyfor the current visitor.optOut()records a Do Not Sell or Share choice; it only acts in opt-out mode.getVisitorId()returns this browser's pseudonymous GetCookies visitor id. Consent records are stored under it, so send it to your server to look the visitor up with the Consent Verification API.
Tips
show,hide,reset,updateConsent,onandoffcalls made before the widget has loaded are queued by the loader and run once it is ready.getConsent()andhasConsent()returnnullandfalseuntil then.- Treat visitors who never choose as not consenting.
Pořád si nevíte rady?
Napište na [email protected] a uveďte svou doménu a co jste zkusili. Přihlášení zákazníci mohou také otevřít tiket z dashboardu.