Framework integrations
Next.js, Nuxt, Astro, Remix, Gatsby, Vite, WordPress, Shopify, Wix, Webflow, Squarespace, raw HTML.
Add the <script> tag as the first element of your site’s <head>, loaded synchronously - no async, no defer - so it is in place before any tracker on the page can run. The script auto-mounts the banner.
Include it once per page. If a template adds it a second time, only the first copy runs and the browser console says so (Kookiok: consent.js is included more than once on this page), naming the domain group of the copy that runs and of the one that does not. Check those when a site has moved between domain groups: a stale tag left above the new one wins, and if its group does not list the site, no consent is recorded.
<head> <script id="Kookiok" src="https://cdn.kookiok.com/consent.js?id=YOUR_DOMAIN_GROUP_ID" ></script> <!-- everything else --></head>import Script from 'next/script';
<Script id="Kookiok" src={`https://cdn.kookiok.com/consent.js?id=${YOUR_DOMAIN_GROUP_ID}`} strategy="afterInteractive"/>The App Router manages <head> itself, so here the script loads after hydration rather than first. That is safe only because blocking then does not depend on load order: render every analytics or marketing tag inert with type="text/plain" and data-ag-consent - see Script Blocking and data-ag-consent - and do not load trackers through next/script, which preloads them.
Easiest — the official plugin. In wp-admin go to Plugins → Add New, search for KookiOk (or get it from wordpress.org/plugins/kookiok) and activate it. Then open Settings → KookiOk, paste your Domain Group ID, click Connect to verify, and Save. The plugin inserts the script first in <head>, loads it synchronously, and ships a built-in “Verify installation” check.
Prefer not to use a plugin? Add the tag to your theme’s header.php, right after the opening <head> tag and above wp_head(), so it runs before every script WordPress and your plugins print in the head. No async or defer: the script must load synchronously.
<script id="Kookiok" src="https://cdn.kookiok.com/consent.js?id=<?php echo esc_attr($KOOKIOK_DOMAIN_GROUP_ID); ?>"></script>Running a self-hosted analytics plugin (Burst Statistics, self-hosted Matomo, or similar)? One more step is required: annotate its script handles with data-ag-consent so the tracker is gated behind consent. See Script Blocking and data-ag-consent.
Keep your Google Tag Manager container, and put the KookiOk tag in the page’s <head> above the GTM snippet. Do not add KookiOk as a tag inside the container:
<head> <script id="Kookiok" src="https://cdn.kookiok.com/consent.js?id=YOUR_DOMAIN_GROUP_ID" ></script> <!-- Google Tag Manager snippet, unchanged --></head>A tag inside the container runs only once GTM has loaded and has started firing tags, so KookiOk would come too late to hold back what ran before it, and Google does not guarantee that a Custom HTML tag’s commands take effect before the next trigger fires. Above the snippet, KookiOk sets the Google Consent Mode defaults before GTM loads: the Google tags in your container follow the visitor’s choice, and other tags can wait for it through GTM’s consent settings or KookiOk’s dataLayer events. You do not need your own gtag('consent', 'default', ...) block; remove it, so the page has one source for the consent state. See Google Consent Mode v2.
Find your domainGroupId in the Kookiok admin dashboard at the top of any Domain Group page.
Framework integrations
Next.js, Nuxt, Astro, Remix, Gatsby, Vite, WordPress, Shopify, Wix, Webflow, Squarespace, raw HTML.
Verifying installation
Backend verifier: POST /api/v1/domain-groups/{id}/verify-installation runs 4 checks and reports script presence + version.
Script gating
Documented: Script Blocking and data-ag-consent - auto vs manual mode, the annotation contract, storage gating and the replay buffer.
CDN + caching
cdn.kookiok.com (Azure Front Door) fronts the script: 1 hour at the CDN edge, 1 hour in the visitor’s browser. Publishing a change purges the edge automatically, so a visitor who has not cached the script picks it up within about 10 minutes. A visitor who already downloaded it keeps the previous version until their hour is up - allow up to 1 hour for a change to reach everyone.