Installation & Documentation
Everything you need to get up and running
Installation
1. Get your snippet
After creating your account and adding your website, copy your unique snippet from the Installation section of your dashboard and paste it into your site. That's it — the banner will appear automatically.
<script src="https://cookieoffice.com/sdk/cmp.js" data-site-id="YOUR_SITE_ID" async></script>2. Add it to your platform
Paste the snippet as the first script inside <head>, before GA4, GTM, or any other script.
<head> <script src="https://cookieoffice.com/sdk/cmp.js" data-site-id="YOUR_SITE_ID" async></script> <!-- your other scripts below --> </head>
Reference
Advanced usage
Optional features for developers who need more control.
Google Consent Mode v2
Handled automatically — no extra configuration needed. The SDK sets denied defaults before any other script loads, then updates signals when the visitor makes a choice.
<!-- The SDK automatically calls these on your behalf -->
// On page load (default — denied):
gtag('consent', 'default', {
analytics_storage: 'denied',
ad_storage: 'denied',
ad_user_data: 'denied',
ad_personalization: 'denied',
...
});
// After user accepts analytics:
gtag('consent', 'update', {
analytics_storage: 'granted',
});JavaScript API
Access the CMP programmatically via the global cmp object.
// Read current consent state
const state = cmp.getConsent();
// { necessary: true, analytics: false, marketing: false }
// Open preferences panel
cmp.openPreferences();
// Subscribe to consent changes
cmp.onConsentChange((state) => {
console.log('Consent updated:', state);
if (state.analytics) {
// Initialize your analytics tool
}
});
// Accept or reject programmatically
cmp.acceptAll();
cmp.rejectAll();Reopen preferences button
Add a link anywhere on your site — typically in the footer — to let users update their consent at any time.
<a href="#" onclick="cmp.openPreferences(); return false;"> Cookie Settings </a>
