We gave Bolt and v0 the same request: build a one-page site for a small bakery and add Google Analytics. Both delivered a good-looking page within minutes. Both also set up Google Analytics to load on every page, for every visitor, before anyone had been asked anything.
That is the default in AI-built sites, and in the EU, the UK and Norway it is the wrong order. This guide shows what the tools generate, one prompt that fixes it in all of them, and how to check the result.
What Bolt and v0 did with Google Analytics
Neither tool pasted a tag into an HTML file, which is what most older guides assume.
- Bolt built the site with Astro and connected Google Analytics to a measurement setting, loaded on the page.
- v0 built a Next.js app, asked for a
GOOGLE_ANALYTICS_MEASUREMENT_IDvariable in its settings, and loads the Google Analytics tag on every page once the variable is set.
Lovable did the same: the ID in an environment variable, the tag injected on every page. It is tidy, and none of it waits for consent.
Step 1: Add the site to Consentify
Publish the site first so you have its address, then create a free Consentify account and add that address as a domain. The script only loads on domains you have added, so if you connect your own domain later, add it too.
Step 2: Paste this prompt into the tool
In the install step, choose AI builder (Lovable, Bolt, v0). The dashboard gives you this prompt with your own script tag filled in. You can also copy it from here and replace YOUR_TOKEN:
Add the Consentify cookie consent script to this site. Put this exact script tag as the very first element inside <head>, so it is rendered on every page before any other script. Use the root HTML template or root layout (for example index.html, app/layout.tsx or the root route), and keep it as a plain script tag with the async attribute:
<script async src="https://www.consentify.app/api/gateway?token=YOUR_TOKEN"></script>
Then remove all Google Analytics, Google Tag Manager, Meta Pixel, Hotjar, LinkedIn, TikTok and other tracking or advertising code from the project, including environment variables and server functions that only exist for them. Consentify will load those tools after the visitor has agreed.
Finally, add a button with id="revoke-consent-btn" and the text "Cookie settings" to the footer, so visitors can change their choice later.It works the same in Bolt, v0, Cursor, Windsurf or Claude Code, because it describes the goal and the place rather than one framework's file. Removing the tracking code matters as much as adding the script. A tag the AI added earlier keeps firing before consent, banner or not.
Where the script ends up
You do not need to edit anything yourself, but it helps to know what to look for when you check the AI's work:
- Astro (Bolt): in the
<head>of the main layout, usuallysrc/layouts/Layout.astro. Astro leaves a script with theasyncattribute as it is, so it is not bundled or delayed. See Astro's docs on scripts. - Next.js (v0): in the root layout,
app/layout.tsx. Our Next.js guide covers the details. - Vite and React: first inside
<head>inindex.html. - Cursor and other editors: wherever your own project's root template is. The prompt tells the AI to find it.
Publish the site again when the AI is done.
Step 3: Add your tracking IDs in Consentify
Google Analytics is now gone from the code, so add it back the right way. In the Consentify dashboard, open Integrations and paste your measurement ID. Do the same for the Meta Pixel or anything else the prompt removed. Each tool now loads only after the visitor has accepted that category. You can also delete the analytics environment variable from the tool's settings, since nothing reads it any more.
Step 4: Check the result
Open the published site in a private window. The banner should appear, and nothing should be tracking yet. Then run the address through the free GDPR scan, which loads the page as a new visitor and lists everything that starts before consent. If it still finds Google Analytics, the AI missed a copy of the tag. Paste the scan result into the tool and ask it to remove what is listed.
While you are at it, look for Google Fonts in the scan. AI-built sites often load fonts from Google, which sends every visitor's IP address there. Our post on Google Fonts and GDPR has the fix, and our checklist of 7 things AI forgets when it builds your website covers the rest.