cookie consent for Lovable

Cookie consent for Lovable,
in one prompt

Lovable builds the app and the tracking you asked for, and adds no consent step. Ask it for a banner and you get a box that shows a choice and blocks nothing. This page fixes both in ten minutes.

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

the rule

What Lovable ships without

A default Lovable project sets analytics and marketing cookies as soon as those scripts are added. That is the exact behaviour European regulators have been fining, and the legal duty sits with you, the operator, not with the tool that generated the code.

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 Lovable app

Lovable generates a React app on Vite with Tailwind and shadcn/ui, usually with Supabase behind it, and publishes it on a lovable.app subdomain or your own custom domain. The consent runtime belongs in the one file every Vite app has: index.html, first in the head. Lovable edits that file when you ask it to, and it keeps the change across later prompts.

What Lovable will not do on its own is block anything. If you ask for “a cookie banner”, the model writes a component that shows two buttons and stores a boolean, while the Google Analytics or Meta Pixel snippet it added earlier keeps running on every page load. That is worse than no banner: it looks compliant and is not. The prompt below does the two things that matter, in the right order: the runtime first, then every tracker turned into a consent-gated script.

After that, the scanner takes over. It loads your published app in a real browser, in each consent state, and lists what still fires before consent, if anything. Because Lovable apps are single-page, the scan follows the client-side routes it can discover from the rendered DOM; add start URLs in the dashboard for routes it cannot reach from the home page. The consent log records every choice from the moment the banner is live.

set-up

Set it up from Lovable

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 Lovable

    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 script tag as the very first element inside <head> of index.html:
    <script src="https://app.cookiecrumbs.eu/runtime/cc.js"
            data-cc-site="pk_live_…"
            data-cc-env="production"></script>
    Then change every analytics, advertising and social script (Google Analytics, gtag, Meta Pixel, TikTok, Hotjar, HubSpot) to type="text/plain" and add data-cc-category="analytics" or data-cc-category="marketing" to each one. 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 Lovable

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

  • Asking Lovable for “a cookie banner component”You get UI, not blocking. The scripts it added earlier still run on load.
  • Analytics added through a Lovable integrationA GA4 or Pixel snippet added by the builder sits in index.html or main.tsx and fires on load. It needs the text/plain treatment like any other.
  • Supabase auth cookies filed as marketingSession cookies for sign-in are strictly necessary. File them under necessary so the banner does not gate your own login.
  • Testing on the lovable.app preview onlyUse the preview key there and the production key on your custom domain. The scan and the install check need the live URL.
  • No privacy policy and imprint linksThe banner has to link to both, and publishing is refused until they are set. Lovable does not write these pages; you do.

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 Lovable 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 Lovable add a GDPR cookie banner by default?
No. Lovable generates the analytics and pixel scripts you ask for and nothing that asks the visitor first. Asking it for a banner usually produces a cosmetic box that shows a choice and blocks nothing.
Can I add CookieCrumbs without leaving Lovable?
Yes. Paste the prompt on this page into the Lovable chat. It adds the tag first in index.html and turns the trackers into consent-gated scripts. Sign-up and the scan happen in the CookieCrumbs dashboard.
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 Lovable 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.