# Your cookie banner says Reject. Does your code listen?

> Source: <https://dev.to/chapeee/your-cookie-banner-says-reject-does-your-code-listen-2k9c>
> Published: 2026-11-24 05:00:15+00:00

**Recommendation:** Have your coding agent audit the live rendered site in a real browser, not just the repo, and require human approval on each consent-gating change it proposes.
More in the playbook "Designing agent systems": <https://wpnews.pro/playbooks/agent-architecture>

Most cookie banners look fine. You click **Reject**, the banner goes away, and everyone moves on. But the banner is only half the job. The other half is your code: every analytics tag, pixel and embed has to *wait* for that choice. Often it doesn't.

This isn't rare. A 2025 study found that about half of websites send a tracking cookie to a third party before the visitor has consented ([PETS 2025](https://petsymposium.org/popets/2025/popets-2025-0138.pdf)). In 2025 Healthline agreed to a $1.55M settlement, partly because its banner didn't actually turn off tracking cookies ([CMSWire](https://www.cmswire.com/customer-experience/the-new-customer-data-privacy-risk-consent-that-looks-compliant)).

This post covers how to check your own site in five minutes, the three patterns that fix most leaks, and how I now get an AI coding assistant to do the fix over MCP, with me approving every change.

`collect`, `gtag`, `fbevents`, `pixel`, `clarity`, `hotjar`, `tiktok`. Anything that shows up here loaded `_ga`, `_gid`, `_fbp` or `_clck` showing up after Reject means something isn't waiting.
If step 4 or 5 shows requests, your banner is decoration. The good news: the fix is usually small.

Almost always it's one of these:

`<head>`.`<script src="https://www.googletagmanager.com/gtag/js?id=G-XXXX">` the moment it parses it. Your banner hasn't even loaded yet.`posthog.init()` or `analytics.load()` in `_app.tsx` / `main.ts` runs on page load, whatever the visitor chose.
These are the patterns most consent tools support in some form. The attribute names below are Kiescy's, but the idea is the same everywhere.

**1. Scripts: make them inert until consent.** A script with `type="text/plain"` is never run by the browser. The consent tool switches it on when the visitor allows that category.

``` php
<!-- before -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXX"></script>

<!-- after: tag the loader AND its inline config -->
<script type="text/plain" data-pira-category="analytics" async
        src="https://www.googletagmanager.com/gtag/js?id=G-XXXX"></script>
<script type="text/plain" data-pira-category="analytics">
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date()); gtag('config', 'G-XXXX');
</script>
```

In React or Next.js, check the *rendered* HTML: some components drop or rewrite the `type` attribute.

**2. Iframes and pixels: move `src` out of the way.** The browser can't contact a server it doesn't have an address for.

```
<iframe data-pira-category="social"
        data-pira-src="https://www.youtube.com/embed/VIDEO_ID"></iframe>
```

**3. SDKs started in code: wrap the init.**

``` js
window.pira.when("analytics", () => {
  posthog.init("KEY", { api_host: "https://eu.posthog.com" });
});

// If this can run before the consent script has loaded, queue it:
(window.piraQueue = window.piraQueue || []).push((pira) => {
  pira.when("advertising", startAds);
});
```

And if a visitor withdraws consent later, a script that already ran can't be unloaded. Call the SDK's opt-out (`posthog.opt_out_capturing()`) or reload the page.

None of this is hard. It's just tedious: you have to find every tag across layouts, components and third-party snippets, and know which category each tracker belongs to. That's a good job for an AI coding assistant, *if* it knows what's actually wrong on the live site. Guessing from the code alone misses tags that come from a CMS, a tag manager or a plugin.

This is why I built an MCP server for [Kiescy](https://kiescy.com), the privacy compliance tool I work on. (Disclosure: I'm the founder.) Kiescy visits your live site in a real browser as a first-time visitor, records what loads before any choice, clicks Reject, and records what still loads. The MCP server hands those findings to your assistant:

| Tool | What the assistant gets | 
|---|---|
| `list_issues` /`get_issue` | What loaded, on which page, which category it belongs to, and the suggested fix | 
| `get_fix_prompt` | Step-by-step instructions for your codebase, including the tagging rules above | 
| `get_consent_api` | How new code should wait for consent, so the next tag you add doesn't leak | 
| `run_check` /`get_check` | Re-checks the live site after you deploy, and closes the issues that are gone | 

It also checks accessibility (WCAG A/AA with axe-core) and security headers, and the same tools cover those.

Connecting it in Claude Code is one line (Cursor and VS Code configs are in the [repo](https://github.com/chapeee/kiescy-mcp)):

```
claude mcp add --transport http kiescy https://mcp.kiescy.com/mcp \
  --header "Authorization: Bearer YOUR_API_KEY"
```

Then I just say: *"Fix the Kiescy issues on this site."*

The part I cared most about is that the assistant **doesn't get to just start editing**. The server tells it to search the code, show a plan (files and changes) and wait for an explicit OK. The key only covers one website, and through MCP the assistant can't change the banner, account settings or consent records. After I deploy, it calls `run_check`, and the issue only closes if the live site no longer shows it.

There's a second server, `https://mcp.kiescy.com/mcp/documents`, for legal pages. It asks about your business a few questions at a time, drafts or imports your privacy policy, terms and cookie policy, and only publishes after a one-time confirmation in the chat. It never guesses things like where your customers are or what you collect.

I'd love feedback from anyone building MCP servers or dealing with consent on client sites. What would you want an assistant to be allowed to do here, and what should always need a human?

*Kiescy's checks help you comply. They aren't legal advice.*
