Install
AI-built websites (Lovable, Bolt, v0, Cursor, Replit)
How to add a real cookie banner to a website built with an AI tool, with a prompt to paste and what to check afterwards.
AI tools build a website fast, and they will happily write a cookie banner too. The problem is not how it looks. It is what the website does with cookies before the visitor chooses. A banner written by a chat prompt rarely blocks Analytics and pixels, keeps no record of consent, and applies one rule to every country.
Use CookieTrue instead and tell your AI not to build its own.
#Step by step
- Add your website in the dashboard and copy your line from Installation.
- Paste this prompt into your AI tool. Replace the address with your own line.
Add this line inside the <head> of every page, before any other script:
<script id="cookietrue" src="https://cdn.cookietrue.com/s/ct_yoursiteid.js"></script>
Do not write your own cookie banner or consent code. CookieTrue handles it.- Publish, then open your website in a normal browser tab. The dashboard shows Live within a minute.
#Where it goes in common tools
- Plain HTML or Vite: the
<head>ofindex.html. - Next.js:
app/layout.tsx, usingnext/scriptwithstrategy="beforeInteractive". See CMS and frameworks. - Lovable, Bolt, v0, Replit, Cursor: the same
index.htmlor layout file. Ask the tool to put the line there, or paste it yourself in the code view.
#Check that it works
- Open the website in a private window. The banner should appear.
- Do not click anything. In the browser's network tab, Analytics and ad requests should not appear yet.
- Click Accept. They load now.
- Back in the dashboard, Consent log shows your choice.
If a tracker still loads early, see Troubleshooting.
#Remove the old banner
If your AI already wrote a banner, delete it, along with any code that stores consent. Two banners confuse visitors and can cancel each other out.
Still stuck? Write to [email protected]. A person answers, usually the same day.