Consentio

Cookie banner for Svelte / SvelteKit

Comply with GDPR and Google Consent Mode v2 on your Svelte / SvelteKit site with a banner that really blocks scripts before consent and won't slow your site down.

SvelteKit combines server rendering and prerendering, which makes a poorly integrated CMP fail differently than a normal SPA: if the banner depends on document.cookie during build or SSR, it breaks. The fix is to render a neutral state server-side and check real consent only after hydration, with the snippet loaded from app.html, not from a component that hydrates late.

What almost nobody tells you: SvelteKit prerenders pages: any code that checks document.cookie during prerendering breaks, and checking consent only client-side without care causes hydration mismatches.

How to install it on Svelte / SvelteKit

  1. 1. Create your free account (Free plan, 1 site) at signup — no card required. Start free →
  2. 2. Open the dashboard, create your site and copy the snippet with your siteKey.
  3. 3. Paste the snippet in src/app.html inside <head>, before any analytics or GTM script added in +layout.svelte.
  4. 4. Open the site in incognito, reject cookies and check in DevTools that there are no _ga / pixels before accept.
  5. 5. Done! The banner appears and Consent Mode v2 is active automatically. Need more sites or logs? Upgrade to Pro (€9/mo).

Using Google Tag Manager?

Import our official template and fire it with the "Consent Initialization" trigger.

⬇ Download GTM template

Common mistakes with cookies on Svelte / SvelteKit

Why Consentio and not just any free plugin

Guides for other platforms

Keep exploring

Frequently asked questions

Why does the banner break during build/prerendering?

Because it tries to read browser cookies in a non-browser environment (Node). That code needs a window check guard.

Where do I put the snippet in SvelteKit?

In src/app.html, inside <head>, not in +layout.svelte — that way it loads before Svelte hydrates anything.

Compatible with prerendered routes?

Yes: living in app.html, the snippet is included in the generated static HTML just like on dynamic routes.

How much does a CMP cost on Svelte/SvelteKit?

Consentio Free (1 domain) or Pro €9/mo flat. /banner-cookies/svelte · /registro?plan=pro

Get the next step by email

No spam. We'll send the link to create your free banner.

Get your Svelte / SvelteKit site compliant in 5 minutes

Create your free banner, no card needed.

Free for 1 domain · No card · Pro from €9/month

See pricing · Free GDPR checklist