Cookie Consent Banner Generator.
Pick a consent style, colour and wording, and this tool produces a small self-contained HTML, CSS and JavaScript snippet that shows a cookie banner, remembers the visitor's choice and fires an event your analytics can listen for.
Paste the snippet just before the closing body tag. The banner stores the choice in localStorage and dispatches a "cookie-consent" event with the value "all", "essential" or "optout"; load analytics or marketing tags only after you see "all". The banner itself is not legal compliance; your cookie policy and tag behaviour must match.
Cookie Consent Banner Generator is a free online tool from Neweb (neweb.ai) for small businesses, with no sign-up. Pick a consent style, colour and wording, and this tool produces a small self-contained HTML, CSS and JavaScript snippet that shows a cookie banner, remembers the visitor's choice and fires an event your analytics can listen for.
| Cost | Free, no account, no watermark |
|---|---|
| Built for | small businesses, freelancers and sole proprietors |
| Made by | Neweb, the AI website builder and online presence manager (free plan; paid plans from $9/month billed yearly) |
Facts checked October 2026.
What you'll get.
A real example of what this tool produces. Run it above with your own inputs.
If your website sets analytics, advertising or social-media cookies for visitors in the EU or UK, the ePrivacy rules and the GDPR require you to ask first and to make saying no as easy as saying yes. California's CCPA and CPRA take a different approach, requiring a clear "Do Not Sell or Share My Personal Information" option where personal data is shared for advertising. Most small-business sites meet these rules with a heavy consent-management script that slows the page, phones home and costs a monthly fee.
This generator produces the lightweight alternative: a self-contained snippet of about 1.5 kilobytes with the banner markup, its styles and a few lines of JavaScript. Choose an accept-and-reject style for GDPR and UK GDPR, a notice with a do-not-sell link for CCPA, or a notice-only banner if you set no non-essential cookies at all. Set your colour, light or dark theme, position and wording, link to your privacy or cookie policy, and copy the code.
The snippet remembers the visitor's choice in their browser and fires a cookie-consent event with the value chosen, so you can load Google Analytics, Meta Pixel or any other tag only after an "all" answer. The banner is a mechanism, not compliance by itself: your tags must genuinely stay off until consent, and your privacy policy must describe the cookies. The tool is free and comes from Neweb, the AI website builder for small businesses (free plan, paid plans from $9/month billed yearly, $19 month-to-month).
How to use the cookie consent banner generator
Enter your site name and the URL of your privacy or cookie policy; the banner links to it with "Learn more".
Choose the consent style: Accept / Reject for GDPR and UK GDPR audiences, the CCPA notice with a do-not-sell link for California, or notice-only if you use essential cookies alone.
Pick a position, an accent colour that matches your brand and a light or dark theme, and edit the banner text if needed.
Click Generate snippet to see a live preview and the code, then Copy snippet.
Paste the snippet just before the closing
</body>tag on every page (or in your theme footer), and wrap your analytics and marketing tags in a listener for thecookie-consentevent so they load only after "all".
Why this matters for your business
Regulators now check for a real reject button. Data protection authorities in France, Germany, Ireland, the Netherlands and the UK have all published guidance or fined companies for banners that offer "accept" prominently and bury "reject" behind settings. A banner with both options side by side, which is what this generator produces, is the expected baseline.
Third-party consent scripts cost speed. Many popular consent-management platforms add 100 to 300 kilobytes and several network requests before the page is interactive, which hurts Core Web Vitals and therefore search rankings. A 1.5 KB inline snippet has no measurable effect.
Consent is pointless if tags fire anyway. The most common failure in small-business audits is a banner that appears while Google Analytics has already loaded. The event this snippet dispatches makes it straightforward to gate tags properly.
Tips for better results
- Only use the notice-only style if you really set no analytics or marketing cookies; a notice without a reject option is not valid consent in the EU or UK.
- Gate your tags. In Google Tag Manager, create a custom event trigger for
cookie-consentand fire analytics and marketing tags only when the event detail is "all". - Give visitors a way to change their mind: a "Cookie settings" link in the footer that clears the
nw-cookie-consentkey in localStorage and reloads the page is enough. - Keep the banner text short and specific. Say what the cookies do, not "to improve your experience".
- Match the accent colour to your site but keep the reject button equally visible; the generated styles give both buttons the same size.
- Test in a private window to see the banner fresh, click each option and check in the browser network tab that analytics loads only after acceptance.
Example
A real-world walkthrough
Harbor Lane Studio, a web design business in Bristol, uses Google Analytics and an embedded Instagram feed on its site and serves UK and EU clients. The owner selects Accept / Reject, bottom bar, the studio's blue accent and the light theme, points the link at /privacy and keeps the default text.
She pastes the snippet into the theme footer and changes her Analytics tag to load inside a cookie-consent listener that checks for "all". A test in a private window shows the banner appearing with no analytics request until she clicks Accept all; clicking Reject non-essential hides the banner and the request never fires. The site's Lighthouse performance score is unchanged.
Frequently asked questions
Is this cookie banner GDPR compliant?
The banner provides the mechanism GDPR and the ePrivacy rules expect: clear information, a link to the policy, an accept option and an equally prominent reject option, with the choice remembered. Compliance also depends on what your site does with the answer. Non-essential cookies and tags must not be set until the visitor accepts, the policy must describe them, and visitors must be able to withdraw consent. The snippet makes those things possible but cannot enforce them; the generator is a tool, not legal advice.
How do I stop Google Analytics loading before consent?
Wrap the Analytics or Tag Manager code so it runs only inside the consent event. For example: document.addEventListener("cookie-consent", function(e){ if(e.detail === "all"){ /* insert the gtag or GTM snippet here */ } });. Because the banner also fires the event on later visits using the stored choice, returning visitors who accepted still get analytics without seeing the banner again. If you use Google Consent Mode, call gtag('consent','update', ...) from the same listener.
What is the difference between the GDPR and CCPA styles?
GDPR and UK GDPR require opt-in consent before non-essential cookies are set, so the GDPR style offers Accept all and Reject non-essential with equal prominence and sets nothing until the visitor chooses. The CCPA and CPRA work on an opt-out basis: cookies may be set but California residents must be offered a clear "Do Not Sell or Share My Personal Information" link, which the CCPA style provides, storing "optout" when clicked so you can disable advertising tags. If you serve both audiences, use the GDPR style; it satisfies the stricter rule.
Where is the visitor's choice stored, and for how long?
In the browser's localStorage under the key nw-cookie-consent, with the value "all", "essential" or "optout". localStorage has no expiry, so the choice persists until the visitor clears site data or you clear the key. Many regulators suggest re-asking after six to twelve months; you can do that by changing the key name in the snippet when you update your cookie policy, which makes the banner reappear for everyone.
Does the snippet work with WordPress, Shopify, Wix, Squarespace or Webflow?
Yes, anywhere you can add custom HTML to the page footer. On WordPress paste it into the theme's footer template or a header-and-footer plugin; Neweb sites, which run on WordPress, accept it the same way. Shopify has a theme.liquid file, Squarespace and Webflow have footer code injection settings, and Wix has a custom code section in site settings. The snippet uses no libraries, so there is nothing to conflict with existing scripts.
Can I customise the design further?
Yes. The generated CSS is plain and short; edit the colours, font, padding, border radius or position directly in the snippet. The only requirements are that the element keeps the id nw-cc and the buttons keep their data-cc attributes, which the JavaScript uses. If you add a "Cookie settings" link elsewhere on the site, have it remove the localStorage key and reload the page so the banner appears again.
Your entire online presence, on one subscription.
All industries and more. AI website builder, free domain, managed hosting and AI SEO, free to start and from $9/month billed yearly.