Framework · Install guide
Cookie consent for Vue
Updated
In a Vue single-page app, add Kiescy to index.html so it runs before your app bundle, then read consent from Vue when you need it.
- Setup time
- About 10 minutes
- Coding
- One line in your layout
- Laws covered
- GDPR, UK GDPR, CCPA, DPDP
- Google Consent Mode v2
- Built in, basic or advanced
Set up cookie consent on Vue in 3 steps
Why Vue sites need cookie consent
Vue apps often add analytics SDKs (GA4, PostHog, Mixpanel) in main.ts, which start immediately. Under the GDPR they must wait for consent.
Your options on Vue
| Approach | Good for | Watch out for |
|---|---|---|
| A Vue cookie component library | UI only | Can't hold back scripts that run before Vue mounts |
| Kiescy in index.html | Any Vue app | Initialize SDKs from onChange, not at startup |
Add your privacy policy
Put the embed where your privacy policy should appear, or link straight to your hosted policy URL from the footer:
<div data-kiescy-doc="privacy"></div>
<script src="https://script.kiescy.com/embed/policy/YOUR_SITE_KEY.js" async></script>Check that it works
Open your site in a private window: the banner should appear for a first-time visitor. Then run the free privacy check, which opens your site as a new EU visitor and lists anything that still loads before consent.
Kiescy's monitoring repeats that check on a schedule and emails you if a new script starts tracking before consent.
What your Vue visitors see
Kiescy detects where each visitor is and shows the version their law requires, so you don't have to choose between the strictest banner for everyone and no banner at all.
Trackers Vue sites usually load
These are the tools that most often need consent on Vue sites, and how Kiescy treats them. Run a cookie scan to see exactly what yours loads.
| Tool | Category | What happens |
|---|---|---|
| vue-gtag / GA4 | Analytics | Initialize after consent |
| PostHog, Mixpanel | Analytics | Initialize after consent |
| Sentry with session replay | Analytics | Replay records behavior; gate it |
Google Consent Mode v2 on Vue
Kiescy in index.html sets Consent Mode v2 defaults before vue-gtag loads gtag.js.
New to Consent Mode? Read basic vs advanced Consent Mode v2.
Troubleshooting
TypeScript doesn't know window.pira
Declare it in a .d.ts file: interface Window { pira?: { onChange(fn: (c: any) => void): void; open(): void } }.
Compliance checklist for Vue
- A consent banner that blocks non-essential trackers until the visitor agrees (opt-in for the EU, UK and India).
- A "Do Not Sell or Share" option for California visitors, and Global Privacy Control honored.
- A privacy policy that names the tools above, linked from every page.
- A cookie policy listing the cookies your scan finds.
- A way for people to request, correct or delete their data.
- Records of each consent choice, kept as proof.
- A "Cookie settings" link that calls window.pira.open().
Guides for Vue site owners
Questions
Is there a Vue plugin?
Not needed: a script tag in index.html loads first, which is what lets it hold back other scripts.
Does it work with Vue Router history mode?
Yes. The banner runs once per page load, and route changes don't affect it.
Official Vue documentation
Menus move. If a step above doesn't match what you see, Vue's own docs show the current way to add code.
Get compliant this afternoon, not this quarter.
Set up your policies, banner and request form in one place. Free while Kiescy is in early access.