Cookie Banner Starter Generator

Customize a cookie banner and preference starter snippet. Does not block trackers or establish legal compliance.

Build a cookie banner starter

Customize a small banner and preference example. Optional purposes start off; visitors can save a choice and reopen settings.

This starter stores a visitor's choices in their browser and sends a custom event. It does not scan cookies, block scripts, choose which laws apply, or establish legal compliance. Integrate choices with your own technologies and review the result for your site, region, and current rules. Its inline script may also need changes to work with your Content Security Policy.

Banner settings

The generator runs in this browser. Values are not submitted or saved by this tool.

Optional purposes to offer

The sample marks its essential purpose as enabled in the saved preference record. It does not manage your site's essential storage. Optional purposes begin off.

Preview

Your site Choose whether to allow optional analytics or marketing technologies. Privacy policy

The sample marks its essential purpose as enabled; optional choices start off. It does not manage site storage.

The preview is illustrative. The copied snippet includes its own sample preference storage and settings button; it does not control other site scripts.

Starter snippet

Review and adapt it before adding it to your site.

How to use this starter

  1. Enter your site name and notice, then add your policy link.
  2. Choose only the optional purposes your site will actually offer.
  3. Copy or download the snippet and review the generated code.
  4. Integrate its preference-change event with your own technologies before loading optional scripts.
  5. Test keyboard and screen-reader behavior, storage, CSP, and withdrawal in your real site.

This example stores choices in localStorage on the visitor's browser and sends an `infinio:cookie-consent-change` event when the visitor acts. It does not prevent a script from loading; connect that event to your own tag or script controls. Local storage is not an audit log or proof of consent, and inline code may be blocked by your Content Security Policy.

Frequently asked questions

Does this snippet block cookies or scripts?
No. It stores a sample choice and dispatches an event. Connect that event to your own scripts and ensure optional technologies do not load before the appropriate choice.
Does this make my website compliant?
No. A banner cannot determine which laws apply, inventory technologies, configure blocking, or establish compliance. Requirements depend on your site and visitors.
How can visitors change their choice later?
The example leaves a Cookie settings button after a choice. Your site must connect changed preferences to its integrations and test that they take effect.
Why does this use localStorage?
It is a small example of restoring a choice in the same browser. It is not consent evidence, may be unavailable in some contexts, and may not be the right storage method for your implementation.
Infinio Tools
© 2026 Infinio Labs