A lightweight banner that speaks Consent Mode v2
This generator produces a self-contained snippet: a consent banner with Accept all, Reject non-essential and Choose settings buttons, and the Google Consent Mode v2 signals behind them. Before any Google tag loads, it sets the defaults for ad_storage, ad_user_data, ad_personalization, analytics_storage, functionality_storage, personalization_storage and security_storage. When a visitor chooses, it sends a consent update, and the choice is remembered in the browser so the banner does not return on every page.
Setting it up
- Paste the snippet in the head of every page, above your Google tag or Tag Manager container.
- Choose whether defaults are denied for the EEA, UK and Switzerland only, or for everyone. Denying only in those regions follows the common approach for sites that serve a global audience.
- Add a Cookie settings link in your footer that calls sstCookieSettings() so people can change their choice at any time.
- Test with your browser's developer tools and Google's Tag Assistant to confirm the consent signals change after a choice.
What this does not do
Consent Mode tells Google tags how to behave, but it does not block other scripts. Pixels and widgets from other vendors keep loading unless you load them only after consent, so wire those to the saved choice. A banner also does not make a site compliant by itself: your privacy policy, the cookies you actually set and your legal basis all matter. This tool is a starting point, not legal advice, so have the wording reviewed for your situation.
Why a hand-rolled banner
Many consent plugins are heavy, load their own tracking or sit behind a subscription. A small script with no external requests keeps your page fast and leaves you in control of the text and styling. If you need cookie scanning, proof-of-consent logs or a certified Consent Management Platform, use a dedicated service instead.