cookie consent for v0

Cookie consent for v0,
before the first render

v0 gives you a Next.js app. The tag goes into app/layout.tsx with strategy="beforeInteractive", so consent defaults exist before hydration and before any tag manager v0 added.

The whole change: the runtime first, and every tracker turned into a script that waits for its category.

the rule

What v0 ships without

A v0 project with analytics enabled runs it on hydration. Without a consent layer every EU visitor is tracked before the page is even interactive.

The rule is the same everywhere in the EU and the UK: nothing beyond what is strictly necessary may be stored on or read from a visitor’s device before they have agreed. That is Article 5(3) of the ePrivacy Directive, and the agreement has to meet the GDPR’s definition of consent: freely given, specific, informed and unambiguous, with a refusal that is as easy as the acceptance. The UK keeps the same rule in PECR, with narrow exemptions for low-risk statistics since 5 February 2026. California and the other US state laws work the other way round: no opt-in, but an opt-out link and support for the Global Privacy Control signal.

Three things follow for a website. Analytics, advertising and social scripts have to wait for a choice. The choice has to be recorded in a way you can show later, because Article 7(1) puts the burden of proof on you. And withdrawing has to be as easy as agreeing, which means a control that reopens the banner on every page. A banner that shows two buttons and loads Google Analytics anyway fails the first test, and that is the failure regulators have been fining, from the CNIL’s decisions against Google and SHEIN to the Dutch and Belgian authorities’ sweeps.

how it works

How consent works in a v0 app

v0 generates Next.js with the App Router, shadcn/ui and Tailwind, and deploys to Vercel. That makes it the easiest of the builders to get right, because Next.js has one correct answer for a consent runtime: a next/script tag with strategy="beforeInteractive" in app/layout.tsx. Injected into the initial HTML, it runs before hydration and before any tag manager v0 added with the default strategy.

The scripts v0 tends to add, Vercel Analytics, Speed Insights and whatever GA4 or pixel you asked for, are all analytics or marketing and all have to wait. The prompt on this page places the runtime and tags each of them. For components that load a tracker on mount, ConsentGate from @cookiecrumbs/next does the same in the tree.

On Vercel, preview deployments get the preview key and production gets the production key, so a v0 iteration never touches real visitors’ consent. The scan runs against the production domain and the install check confirms the tag is first; both are on the free plan.

set-up

Set it up from v0

Ten minutes, one prompt, no npm.

  1. Create the site, get the key

    Sign up, add the domain your app is published on, and copy the production key from Install. The free plan covers two domains.

  2. Paste this prompt into v0

    It puts the tag first and turns every tracker into a consent-gated script. Read the diff it makes; nothing else should change.

    Add this to app/layout.tsx, before any other script:
    import Script from 'next/script';
    <Script src="https://app.cookiecrumbs.eu/runtime/cc.js"
      strategy="beforeInteractive"
      data-cc-site="pk_live_…" data-cc-env="production" />
    Then change every analytics, advertising and social script to type="text/plain" with data-cc-category="analytics" or "marketing". Do not change anything else.
  3. Publish, then scan

    Publish the app. In the dashboard, run the first scan: it loads the live app in a real browser and lists what still fires before consent, if anything.

  4. Sort once, set the legal links, publish the banner

    File each vendor under a category, set your imprint and privacy links, publish. The banner is live and the consent log is recording.

  5. Run the install check

    It loads your page like a visitor and confirms the banner ran before any tracker. That tick is the proof.

watch out

Mistakes we see with v0

Each one shows up in the first scan as a tracker that fired before consent.

  • afterInteractive for the runtimeThe default strategy runs after hydration. Only beforeInteractive is early enough.
  • Vercel Analytics counted as necessaryIt is analytics. Gate it like GA4.
  • A banner from a v0 UI promptBeautiful, and it blocks nothing. The runtime has to gate the scripts.
  • Environment variables for the site keyFine, as long as the tag itself stays in app/layout.tsx and first.
  • Skipping the scan because “it is just a landing page”Landing pages carry the most pixels of any page type. Run it.

before you ship

The compliance checklist

Eight lines. The dashboard ticks the last two from real data.

  • The tag is the first script in the headAnything above it can set a cookie the runtime cannot take back.
  • Every analytics, ads and social script waits for its categoryEither type="text/plain" with a category, or the host is in the block map from the scan.
  • Reject all is on the first layerSame size, same weight as Accept all. No “X” that counts as consent, no pre-ticked boxes.
  • Consent Mode defaults are denied before Google loadsCheck the seven signals in Tag Assistant with consent denied.
  • The imprint and privacy policy links are setPublishing is refused until both are there; the banner footer links to them.
  • A withdraw control is reachable on every pageThe persistent control or a “Manage cookies” link in your footer.
  • The first full scan ran and every vendor is filedThe verdict on Home says what fired before consent, dated.
  • The install check passedIt loads your page like a visitor and confirms the banner ran before any tracker.

what you get

What you get on the free plan

Two domains, 100 subpages scanned a month per domain, every regulation, the CLI, the SDKs and the MCP server.

A scanner that reads the rendered page

Every page, in each consent state, in a real browser. Cookies, pixels, iframes and storage keys, with the page and script that set them. Re-scanned on a schedule.

The cookie declaration writes itself from the result.

A banner that blocks first

Tags stay inert until their category is granted. Reject all is as visible as Accept all. Seven layouts, 25 languages, Consent Mode v2, and the right rule per region.

21 kB, one file, no third-party requests of its own.

Proof you can hand over

Each choice is stored with a timestamp, the banner version and a hash of the texts shown, chained to the record before it. Exports are signed. Hosted in Frankfurt.

Article 7(1), on the free plan.

free check

See what your v0 app loads right now

The homepage HTML, matched against the tracker database. No account, nothing stored. The full scan in the dashboard does the same for every page, in a real browser.

questions

Straight answers

Does v0 add a GDPR cookie banner by default?
No. v0 generates the UI and the analytics you ask for and nothing that asks the visitor first.
Where does the tag go in a v0 project?
In app/layout.tsx as a next/script tag with strategy="beforeInteractive", before any other script. The prompt on this page does it.
Is a cookie banner required for a small app?
If the app serves visitors in the EU or the UK and sets any non-essential cookie, analytics included, then yes. The duty sits with the operator of the site, not with the tool that generated it. A hobby project with no analytics and no embeds needs nothing.
Will the banner slow the app down?
The runtime is 21 kB gzipped, one file, loaded async, with no third-party requests of its own. The bar and ribbon layouts reserve their space before paint, so no layout shift.
Can I keep using the builder afterwards?
Yes. The tag and the gated scripts are ordinary HTML that v0 preserves between edits. Re-run the scan after big changes; the dashboard alerts you when a new tracker appears.
Where does the consent data go?
To Frankfurt, Germany. Records never leave the EU, no IP address or user agent is stored beside a record, and every record exports as signed CSV or JSON, including after you cancel.

next step

Compliant before you share the link

Free plan, two domains, no card. Scan the live app first if you want to see what it loads today.