Installing the Widget
Last updated: September 8, 2026
The Cookiestack widget is a single <script> tag — no build step, no npm package, no code changes on your end. Takes 2–3 minutes.
1. Get an API key
Sign up and add a domain under Domains. Each domain gets its own unique data-api-key, tied to its own banner configuration and consent statistics.
2. Add the tag to <head>
<script src="https://api.cookiestack.dev/widget.js" data-api-key="YOUR_API_KEY" async ></script>
Place it inside <head>, before any other tracking tags (Google Tag Manager, Yandex Metrica, etc.) — otherwise those can load before the widget sets a default consent state.
async doesn't block page rendering. The script determines which API server to talk to from its own src automatically — no need to change that address manually.
3. Verify the install
Open your site in an incognito window — the consent banner should appear on first load. If it doesn't, check the browser console:
[Cookiestack] data-api-key attribute is missing on the script tag.— thedata-api-keyattribute is missing or empty.[Cookiestack] failed to load config.— the domain isn't verified yet, or the key wasn't found. See "First domain".
Once a visitor gives consent, the banner is replaced by a small floating "Customize" badge in the bottom-left corner — clicking it reopens the preferences at any time.
What's next
- Banner configuration — colors, position, text, languages.
- Yandex Metrica integration — no manual snippet needed.
- JavaScript API — how to block your own scripts until consent.