How to Create a Cookie Policy and Banner
- Enter your website details and the date the policy takes effect.
- Tick the cookies you use. The generator adds the standard cookies for Google Analytics 4, AdSense and YouTube, with provider, purpose and duration.
- Add any other cookies, one per line, in the format
name | provider | purpose | duration | category. - Customise the banner: position, colour, text and a link to your cookie policy. Click Live preview to try it.
- Publish the policy as a page such as
/cookie-policy.html, paste the banner code into the<head>of every page, and add a "Cookie settings" link to your footer.
What Is a Cookie Policy?
A cookie policy is a page that tells visitors which cookies and similar technologies your website uses, who sets them, what they're for and how long they last, and how visitors can control them. In the European Union and the UK, the ePrivacy Directive (the "cookie law") and the GDPR require websites to give this information clearly and to get consent before setting non-essential cookies, such as those for analytics and advertising. In the US, laws like the CCPA/CPRA require disclosure and an opt-out for advertising cookies that count as "sharing" personal information. Some sites include cookie information inside their privacy policy, but a separate cookie policy with detailed tables is clearer and easier to keep up to date.
Cookie Categories Explained
| Category | Examples | Consent needed in EU/UK? |
|---|---|---|
| Strictly necessary | Security, load balancing, remembering cookie choices | No |
| Preferences | Language, theme, region | Usually yes |
| Analytics | Google Analytics _ga, _ga_<ID> | Yes |
| Advertising | Google AdSense __gads, __gpi, IDE | Yes |
| Embedded content | YouTube YSC, VISITOR_INFO1_LIVE | Yes |
About the Consent Banner Code
The generated banner is a single, dependency-free snippet of about 3 KB. It shows Accept all, Reject all and Customise buttons with equal prominence, as European regulators expect, stores the visitor's choice for 12 months in a first-party cookie, and exposes openCookieSettings() so visitors can change their mind at any time. It integrates with Google Consent Mode v2: it sets analytics_storage, ad_storage, ad_user_data and ad_personalization to "denied" by default, then updates them when the visitor accepts. Google Analytics and Google Ads tags adjust their behaviour automatically. It also respects the Global Privacy Control signal by leaving marketing cookies off by default, and fires a cookieconsent event you can use to load other scripts only after consent.
Important for AdSense publishers: Google requires a Google-certified CMP for serving ads to users in the EEA, the UK and Switzerland. If you show AdSense ads to those visitors, use Google's free "Privacy & messaging" consent message (or another certified CMP) for them. This banner is well suited to analytics-only sites, sites without EU traffic, and non-Google tools.
Adding the Policy and Banner to Your Site
For static HTML sites, create a cookie-policy.html page from the downloaded file and paste the banner code into the shared <head> of your template. On WordPress, add the policy as a page and insert the banner code with a header-scripts plugin, or in your theme's header.php before other tracking code. On Blogger, paste the code just after the opening <head> tag in Theme › Edit HTML. After publishing, open the site in a private window, check that no analytics or advertising cookies appear before you click Accept, and that they appear afterwards. This simple test shows your consent setup is working.
Frequently Asked Questions
Is this cookie policy generator free?
Yes. The policy and the banner code are free to use on any website, including commercial sites, with no attribution required.
Do I need a cookie banner?
If you use non-essential cookies such as analytics or ads and have visitors from the EU or UK, you need to ask for consent. Sites that only use strictly necessary cookies don't need a consent banner, but should still explain their cookies.
How do I find out which cookies my site uses?
Open your site in Chrome, press F12, and go to Application › Cookies to see every cookie with its domain and expiry. Check again after accepting the banner.
Where do I put the banner code?
At the top of the <head> on every page, before Google Analytics, Google Tag Manager or AdSense code, so the consent defaults are set first.
Is this legal advice?
No. The generator follows common practice and official guidance, but you're responsible for making sure the policy matches your website. Consult a lawyer if you're unsure.