- Is this banner GDPR compliant?
- The banner gives the visitor an explicit choice (Accept, Reject, or Customize), defaults non-essential categories to OFF in the customize panel, refuses to load anything until the visitor opts in via the dispatched event, and stores the decision so it's not asked again. Those are the structural requirements of GDPR and the UK Data Protection Act. The remaining piece — what your site actually does with cookies — is on you. If your analytics or ad scripts only load after `cookieconsentchange` fires with the matching category set to `true`, you're in good shape. If they load on page open regardless, the banner isn't doing anything useful.
- How do I make my analytics script wait for consent?
- Listen for the event. Example: `window.addEventListener('cookieconsentchange', (e) => { if (e.detail.analytics) { /* load Google Analytics or Plausible here */ } });`. The `e.detail` object has `necessary`, plus whichever categories you enabled (e.g. `analytics`, `marketing`, `preferences`), each a boolean. If consent was already granted on a previous visit, the event fires once on page load with the stored decisions — your script doesn't need to handle both cases separately.
- Where does the consent decision get stored?
- In `localStorage`, under the key you pick (default `cookie-consent`). The value is a JSON object: `{ consent: { necessary: true, analytics: false, ... }, timestamp: '2026-05-14T…', version: 1 }`. The timestamp is useful if you ever need to re-prompt (e.g. you added a new category). The banner is hidden on subsequent visits as long as the key exists.
- How do I let users change their mind later?
- The script exposes a small API on `window.MicroappCookieConsent`. Call `window.MicroappCookieConsent.reset()` from a 'Cookie settings' link in your footer to clear the saved decision and show the banner again. Or call `window.MicroappCookieConsent.set({ analytics: true })` to programmatically update the choice without re-showing the banner.
- Does this work without a cookie consent management platform like OneTrust or Cookiebot?
- Yes. The banner is self-contained — no third-party SDK, no external network calls, no script tags loaded from someone else's server. That's the point: instead of paying $30-200/month for a CMP that loads its own tracking, you paste a snippet that does the same job in 4KB of code. Bigger sites with complex regional rules (different EU member states, CCPA, LGPD all mixed) eventually need a CMP because the rule set gets too fiddly to maintain by hand. For most sites, this is enough.
- Why is the 'Necessary' toggle always on and locked?
- Necessary cookies are the ones that make the site work — session cookies that keep you logged in, CSRF tokens that prevent attacks, load-balancer cookies that route you to the right server. GDPR and similar laws explicitly exempt strictly necessary cookies from the consent requirement, on the grounds that without them the site literally doesn't function. The toggle is shown so visitors can see what's running, but it can't be turned off because turning it off would break the site.
- Can I add a fourth category?
- The generator exposes three optional categories (analytics, marketing, preferences). If you need more — for instance, a separate 'social media' bucket for embedded YouTube or Twitter widgets — you'd extend the generated JS by hand. The structure is straightforward: add the category name to the `CATEGORIES` array, add a row to the markup, and have your scripts check the new key in `e.detail`. Most sites don't need more than three.
- Does the banner work on mobile?
- Yes. The CSS is responsive — below 540px width, the buttons stretch to full width and the padding tightens up. The detailed style's customize panel also collapses gracefully. The banner uses `position: fixed` so it stays visible while the page scrolls, and the z-index is high enough (2147483647 — the max signed 32-bit integer) to sit on top of dropdowns and modals from other libraries.
- Will this banner slow my site down?
- The CSS is ~2KB and the JS is ~2KB, both inlined — no extra HTTP requests, no render-blocking imports. The script runs once on page load to check localStorage and either show or hide the banner. There's no polling, no observer, no continuous work. The performance cost is unmeasurable; what slows sites down is the analytics scripts the banner gates, not the banner itself.
- What happens if a visitor blocks localStorage (private browsing, strict mode)?
- The script catches the error silently. The visitor sees the banner every time they load the page in that session, since there's nowhere to remember their choice. The dispatched event still fires correctly, so analytics scripts that wait for consent will still respect the visitor's per-page decision. This is the same behavior every consent tool has — there's no workaround when storage is denied.