Cookie Consent Banner Generator

Generate a cookie banner with Google Consent Mode v2 defaults that you can paste into any website, with the text and buttons you choose.

Did this tool help? Rate it Be the first to rate this tool

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.

Consent Mode basics

Google Consent Mode v2 passes signals such as ad_storage, analytics_storage, ad_user_data and ad_personalization to Google tags. Defaults should be denied until the visitor chooses, for visitors in regions that require consent such as the EEA and the UK.

Good banner design

Give equal prominence to Accept and Reject, explain categories in plain words, let people change their choice later and keep a record of consent. Do not load non-essential scripts before consent.

Check it works

Test with browser developer tools, confirm tags respect the choice and review the privacy policy. Laws differ by country, so ask a legal adviser for your situation.

Prepare your site

Make a list of the cookies and scripts your site uses, such as analytics, advertising and embedded videos, and sort them into necessary, preference, statistics and marketing. Block non-essential ones until consent. Add a link to your cookie policy and a way to change the choice later. Test in a private window and with the browser console open to confirm that blocked scripts do not run.

Keep it updated

Update the banner whenever you add a new tracking tool, plugin or embedded service.

Frequently asked questions

Does this work with Google AdSense and Analytics?

Yes. Both read the Consent Mode signals that the snippet sets. For AdSense in the EEA, UK and Switzerland, Google also requires a certified consent management platform for personalised ads, so check the current AdSense requirements.

Where is the visitor's choice stored?

In the browser's localStorage on your own domain under the key sst_consent_v1. Nothing is sent to us.

Will it block my Facebook Pixel or other tags?

No. It controls Google tags through Consent Mode only. Load other scripts after the saved choice allows them.

Is this legally enough for GDPR or CCPA?

It is a technical starting point. Compliance also depends on your privacy policy, the data you collect and local rules, so get advice if you are unsure.

Can I change the colours and text later?

Yes. Change the options and generate the code again, then replace the old snippet.

More in Technical SEO & Site Management