{"slug": "your-cookie-banner-says-reject-does-your-code-listen", "title": "Your cookie banner says Reject. Does your code listen?", "summary": "A developer at privacy compliance tool Kiescy built an MCP server that loads a live site in a real browser as a first-time visitor, records what fires before any consent choice, clicks Reject, and records what still loads, then hands those findings to an AI coding assistant for fixes with human approval on every change. The post cites a 2025 PETS study finding roughly half of websites set a third-party tracking cookie before consent, and a $1.55M Healthline settlement partly over a banner that did not stop tracking cookies. It also outlines three remediation patterns: inert type=\"text/plain\" scripts, moving iframe src into data attributes, and wrapping SDK init calls behind a consent gate.", "body_md": "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.\n\nThis 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)).\n\nThis 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.\n\n`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.\nIf step 4 or 5 shows requests, your banner is decoration. The good news: the fix is usually small.\n\nAlmost always it's one of these:\n\n`<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.\nThese are the patterns most consent tools support in some form. The attribute names below are Kiescy's, but the idea is the same everywhere.\n\n**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.\n\n``` php\n<!-- before -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=G-XXXX\"></script>\n\n<!-- after: tag the loader AND its inline config -->\n<script type=\"text/plain\" data-pira-category=\"analytics\" async\n        src=\"https://www.googletagmanager.com/gtag/js?id=G-XXXX\"></script>\n<script type=\"text/plain\" data-pira-category=\"analytics\">\n  window.dataLayer = window.dataLayer || [];\n  function gtag(){dataLayer.push(arguments);}\n  gtag('js', new Date()); gtag('config', 'G-XXXX');\n</script>\n```\n\nIn React or Next.js, check the *rendered* HTML: some components drop or rewrite the `type` attribute.\n\n**2. Iframes and pixels: move `src` out of the way.** The browser can't contact a server it doesn't have an address for.\n\n```\n<iframe data-pira-category=\"social\"\n        data-pira-src=\"https://www.youtube.com/embed/VIDEO_ID\"></iframe>\n```\n\n**3. SDKs started in code: wrap the init.**\n\n``` js\nwindow.pira.when(\"analytics\", () => {\n  posthog.init(\"KEY\", { api_host: \"https://eu.posthog.com\" });\n});\n\n// If this can run before the consent script has loaded, queue it:\n(window.piraQueue = window.piraQueue || []).push((pira) => {\n  pira.when(\"advertising\", startAds);\n});\n```\n\nAnd 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.\n\nNone 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.\n\nThis 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:\n\n| Tool | What the assistant gets | \n|---|---|\n| `list_issues` /`get_issue` | What loaded, on which page, which category it belongs to, and the suggested fix | \n| `get_fix_prompt` | Step-by-step instructions for your codebase, including the tagging rules above | \n| `get_consent_api` | How new code should wait for consent, so the next tag you add doesn't leak | \n| `run_check` /`get_check` | Re-checks the live site after you deploy, and closes the issues that are gone | \n\nIt also checks accessibility (WCAG A/AA with axe-core) and security headers, and the same tools cover those.\n\nConnecting it in Claude Code is one line (Cursor and VS Code configs are in the [repo](https://github.com/chapeee/kiescy-mcp)):\n\n```\nclaude mcp add --transport http kiescy https://mcp.kiescy.com/mcp \\\n  --header \"Authorization: Bearer YOUR_API_KEY\"\n```\n\nThen I just say: *\"Fix the Kiescy issues on this site.\"*\n\nThe 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.\n\nThere'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.\n\nI'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?\n\n*Kiescy's checks help you comply. They aren't legal advice.*", "url": "https://wpnews.pro/news/your-cookie-banner-says-reject-does-your-code-listen", "canonical_source": "https://dev.to/chapeee/your-cookie-banner-says-reject-does-your-code-listen-2k9c", "published_at": "2026-11-24 05:00:15+00:00", "updated_at": "2026-11-24 05:12:57.024855+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-tools", "developer-tools"], "entities": ["Kiescy", "Healthline", "PostHog", "Google Tag Manager", "PETS 2025", "CMSWire"], "also_reported_by": [], "takeaway": "Gate every tracker on consent by making scripts inert with type=\"text/plain\", moving iframe src into data-pira-src, and wrapping SDK init in a consent callback, then verify against the live rendered page rather than source code since CMS and tag-manager tags are invisible in the repo.", "recommendation": {"advice": "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.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/your-cookie-banner-says-reject-does-your-code-listen", "markdown": "https://wpnews.pro/news/your-cookie-banner-says-reject-does-your-code-listen.md", "text": "https://wpnews.pro/news/your-cookie-banner-says-reject-does-your-code-listen.txt", "jsonld": "https://wpnews.pro/news/your-cookie-banner-says-reject-does-your-code-listen.jsonld"}}