All articles
StrategyTechnical

6 November 2026 · 15 min read · updated 11 November 2026

A cookie banner is not a consent record

When I moved five sites off WordPress to Astro (keeping Wordpress as a back-end), I rebuilt the cookie banners and left out the part the law requires: a record of what each visitor chose. Putting that right took an open-source library, one Postgres database and a few lessons about defaults.

The short version

When I moved five sites off WordPress, I installed c15t, an open-source consent library, on three of them, and did it wrong. Each got a cookie banner and nothing else: the visitor’s choice was saved only in their own browser, no copy ever reached a server, and on one site Google’s tag still loaded before anyone clicked. The other two sites had no consent tool at all.

It was an easy mistake to make, because on WordPress consent is almost invisible work. A consent plugin shows the banner, holds back tracking scripts and writes every decision to the same WordPress database the site already runs on. Nobody sets up the record-keeping, because the plugin does it. A “headless” site, with a separate front end built in Astro and WordPress kept only for content, leaves that database behind, and the record goes with it.

The fix I settled on is c15t set up in full: its backend runs inside each site, and the records sit in one Postgres database on Supabase that I already pay for, with a separate schema and database login for every site. Nothing loads before consent, rejecting is as easy as accepting, and every choice is stored with its policy version, but without the visitor’s IP address. That makes the records minimised, not anonymous: a random visitor ID is still an online identifier.

SiteBeforeAfter
Shop 1c15t banner, choices kept only in the browserChoices recorded in its own schema
Shop 2c15t banner, choices kept only in the browser; analytics loaded before consentAnalytics and ads wait for consent, choices recorded
Shop 3c15t banner, choices kept only in the browser; “reject” a weaker outline buttonEqual buttons, choices recorded
Site 4No bannerBanner, choices recorded
BlogNo bannerBanner, choices recorded

I am not a lawyer, and nothing here is legal advice. I wanted to understand what the rules ask of a small shop and whether my sites met them; where the law is involved, I link to the source so that you can read it yourself.


What the plugin used to do

The legal requirement has two halves, and a plugin covers both without being asked. The ePrivacy rules (PECR in the UK) say a site may only store or read anything on a visitor’s device that is not strictly necessary with their consent. National laws carry the same rule: in Poland, where three of these sites are run, it is article 399 of the Electronic Communications Law of 12 July 2024; in Germany, section 25 of the TDDDG. The GDPR adds that whoever relies on consent must be able to demonstrate it was given (article 7(1)). A banner satisfies neither on its own: it asks the question but keeps no record of the answer.

A typical WordPress consent plugin therefore does more than draw a box at the bottom of the page. It rewrites or blocks the analytics and advertising tags in the theme until consent arrives, it applies different rules to visitors from different countries, and it logs each decision with a timestamp and the wording that was shown. Most site owners never see that last part until a regulator, or a lawyer, asks for it.

What breaks when the front end moves

A headless front end does not inherit any of this. The new site renders its own pages, so the plugin’s banner never appears; the tracking tags move into the new layout, where nothing blocks them; and the consent log, if it existed, stays behind in a WordPress database the public site no longer touches.

What I did next was reasonable and incomplete. I added a JavaScript consent library, configured it to remember the choice in the visitor’s browser, and wired the analytics tag to it. The banner looked right and the cookies behaved, but there was no record anywhere that a court or a regulator would accept, because the only copy of each choice sat on a device the site owner does not control.

Three columns: on WordPress the consent plugin showed the banner, held tags back and logged each choice in the WordPress database; the first headless attempt kept only the banner and stored choices in the visitor's browser, with no proof; now tags wait for consent and every choice is recorded in the site's own schema, without the IP address.
Fig. 01: What the consent plugin did on WordPress, what survived my first headless attempt, and what is in place now.

What the audit found

I checked each live site the same way: a fresh browser profile, every network request and cookie recorded before any click, then again after “reject” and after “accept”. A banner on screen proves nothing; the network requests show what the page does.

  • No proof anywhere: all five sites either kept choices only in the browser or had no consent tool at all.
  • Analytics before consent: Shop 2 loaded Google’s tag immediately in “advanced” Consent Mode, which sends cookieless pings to Google before the visitor decides. Google allows it, but the EDPB’s guidelines on the technical scope of the ePrivacy rules (version 2.0, October 2024) treat tracking pixels and similar requests as access to the visitor’s device, which needs consent first. It is not a position I want to defend for a client.
  • Unequal buttons: Shop 3’s banner showed “accept all” as a solid button and “reject all” as a faint outline. The EDPB’s cookie banner task force (report adopted on 17 January 2023) looked at exactly this: its members agreed that colours and contrast can make a banner manifestly misleading, judged case by case. And in January 2022 France’s regulator, the CNIL, fined Google €150 million and Facebook €60 million because refusing cookies took more effort than accepting them.
  • Nothing to consent to: Shop 3, Site 4 and the blog set no tracking cookies at all, and Shop 3 showed a banner anyway. A banner there is still sensible if analytics may come later, but it should say so plainly.
Network log of a first visit to Shop 2. Before the fix, Google's tag loaded and a ping reached Google Analytics before any click, and rejecting saved the choice only in the browser. After the fix, no analytics or advertising host is contacted before a click, and rejecting sends one save to the shop's own /api/consent route, with no IP address.
Fig. 02: The same first visit to Shop 2, before and after the fix. Before, Google heard from the page before the visitor decided. After, nothing reaches a third party until there is a choice, and the choice itself is recorded on the shop's own server.

The options

There are four realistic ways to put consent back. They differ less in the banner, which all of them draw well, than in where the records live and who runs the machinery.

OptionRecords liveCostControlRunning it
Commercial consent platform (Cookiebot, Usercentrics, OneTrust)The vendor’s serversCookiebot: free for one small domain, then roughly €7–30 a month per domain by page countConfiguration through their dashboardVendor
c15t with its hosted backend (Inth)Inth’s serversFree to 500 consent sessions a month; $36 a month for 5,000; $124 for unlimited sitesOpen source, full code controlVendor
c15t, self-hosted backendYour own databaseYour database and hosting; for me, nothing on top of a $25-a-month Supabase plan I already payFullYou
Build it yourselfYour own databaseYour timeFullYou, indefinitely

The figures are the vendors’ published prices in November 2026 and change often, so check their pricing pages before deciding. For five sites, Cookiebot would cost something like €35–150 a month and Inth’s plan for several sites $124. For me the marginal cost of self-hosting is nil: five sites’ records fit in a few megabytes of a database plan I already pay for, and the consent routes run within the hosting plan the sites already use.

A commercial platform is the right answer for many organisations, especially with a large marketing team that needs vendor lists and audit dashboards. It is also another data processor in the chain, another script on every page and another invoice per site. Building from scratch looks cheap at first, but the regional rules, policy versioning and edge cases take most of the effort.

Why I self-hosted

I chose the third option for four reasons. All five sites already run on Vercel, so a small server route costs nothing extra. I already pay for Supabase, which is Postgres underneath, and consent records are tiny: a few hundred bytes each. Keeping them in my own accounts means one fewer company handling visitors’ data. And c15t’s self-hosted backend speaks the same API as its hosted one, so moving to Inth later is a change of URL, not a rewrite.

The cost is that I own what a vendor would otherwise own: database access, upgrades and keeping the rules current. For a handful of sites that is about an afternoon a year; for fifty, I would reconsider.


How it is built

Each site runs the backend as one on-demand route, /api/consent, beside otherwise prebuilt pages. The banner talks to its own site, never to a third party, and the route writes to Postgres.

The banner talks only to its own site; each site's /api/consent route writes to Postgres on Supabase over TLS with the root certificate pinned. One project holds a separate schema and login per site; another site's login is refused, the public data API has no access, and a record never holds the IP address or user agent.
Fig. 03: Where a visitor's choice goes: from the banner to the site's own route, then over TLS to a schema only that site can use.

All five sites share one Supabase project, but not one set of tables. Each has its own schema, and the tables in it are owned by that site’s own database login, with no rights granted to anyone else. Another site’s login is refused, and none of the schemas is exposed through Supabase’s public web API. The project’s administrative login is a different matter: Supabase gives it a built-in role that can read every table, so it can read consent records, though it cannot change or delete them. That is acceptable here, because the same company runs the project and the sites. The password below is pre-hashed, so the plaintext never passes through a database tool:

-- a pre-hashed SCRAM verifier; the plaintext password stays in a file outside the chat and the tools
create role c15t_site_a with login password 'SCRAM-SHA-256$4096:…' noinherit;
create schema if not exists c15t_site_a;
grant usage, create on schema c15t_site_a to c15t_site_a;
revoke all on schema c15t_site_a from public, anon, authenticated;
alter role c15t_site_a set search_path = c15t_site_a;

The rules are deliberately simple. c15t ships regional presets, and its recommended pack shows no banner in countries without a privacy law. That does not suit a business established in the EU or the UK, where the GDPR applies to every visitor regardless of where they are (article 3(1)). So every site uses the European opt-in rule, widened to everyone:

const europe = policyRulePresets.europeOptIn();

export const policyRules = [
  {
    ...europe,
    id: 'site_opt_in_everywhere',
    match: policyMatchers.merge(europe.match, policyMatchers.default()),
    proof: { storeIp: false, storeUserAgent: false, storeLanguage: true },
  },
];

Each stored choice holds the visitor ID, the action (“accept_all”, “reject_all” or a custom selection), the categories, the policy version, the language and an expiry date. It does not hold the IP address or the browser’s user agent. The visitor ID is created on the first visit and kept in a first-party cookie, <site>-consent-sid, for 12 months; it exists only to tie a choice to its record, so it is strictly necessary and needs no consent itself. Is such a record personal data? Yes. A random ID with no name, email or IP address attached is pseudonymous, not anonymous: it singles out one browser, and the GDPR counts pseudonymous data as personal data (recital 26). Dropping the IP address and user agent makes each record far less revealing, but the records still fall under the privacy notice, the retention limit below and visitors’ rights. Records are append-only: a change of mind, including a withdrawal, adds a new row rather than overwriting the old one, so each visitor’s history of choices survives intact.

A choice is valid for 12 months, after which the banner asks again. That is a judgement, not a legal rule: long enough not to nag readers, short enough that a choice still reflects the tools a site uses. Records are then kept for three years after they expire, as proof, and deleted by a nightly job inside the database. Each site’s own login owns the function that does the deleting; the scheduler may only call it.

The consent routes run in Vercel’s Dublin region, next to the database in Ireland. Like any web host, Vercel still sees each visitor’s IP address in its request logs; the consent database does not keep it.

Tracking now waits for consent. On Shop 2, Google’s tag is not loaded at all until the visitor allows analytics, and the Meta pixel waits for marketing consent; withdrawing consent reloads the page, which stops both, and deletes the cookies they set (_ga, _fbp and Google’s advertising cookies). Accept and reject share the same filled button style on every site, and each banner uses the site’s own fonts, colours and corner radius, so it looks like part of the page rather than a third-party widget.

What went wrong

None of these broke a live site, but several would have, and two were security problems rather than inconveniences.

  1. The database connection was unencrypted by default. The Postgres driver c15t uses connects without TLS unless told otherwise, and Supabase’s connection pooler accepts plain connections. My first test sent a database password across the internet in clear text. Neither default is c15t’s. Most Postgres drivers connect without encryption unless asked, and Supabase accepts such connections unless its SSL enforcement setting is on. I had done neither, so the mistake was mine. I rotated it, over an encrypted connection, and every site now connects through a small wrapper that requires TLS and pins Supabase’s own root certificate, with verification left on. Turning verification off would have been quicker, and would have left the connection open to interception.
  2. The default preset stores IP addresses. c15t’s European preset keeps the visitor’s IP address and user agent as proof. They add little to what a visitor ID and a timestamp already show, and they make each record far more identifying. They are now switched off; the records remain personal data, but minimised.
  3. A route name clash. The Astro integration reserves /api/c15t for itself, so the backend has to live elsewhere. It is at /api/consent.
  4. Two copies of one library. The backend needs effect 4.0.0; npm installed 4.1.2 alongside it for the database driver. The two copies could not read each other’s protected values, and the error said only “Unable to get redacted value”. Pinning one version fixed it.
  5. Raw TypeScript at build time. On fully prebuilt sites, importing the banner components through the umbrella c15t package made Node load TypeScript source straight from node_modules. Importing from @c15t/astro directly lets Astro compile it.
  6. A 55-second first request. On one site the first call to the consent route took almost a minute. The cause was not c15t but my local development container, whose files sit on a Windows folder mount; the same build answered in 187 milliseconds from the container’s own disk, and production runs on fast Linux storage.
  7. Language follows the browser, not the address. On Shop 2, which runs in two languages, c15t picks the dialog’s language from the browser rather than the URL. The banner text is now passed per page; the settings dialog stays in the browser’s language, which for nearly all of its visitors is Polish.
  8. Polish labels are long. “Zapisz ustawienia” pushed a button past the edge of the settings dialog. The buttons now wrap.
  9. The functions ran in Washington. Vercel’s response headers (x-vercel-id: fra1::iad1::…) showed the consent routes running in its US East region while the database sat in Ireland, so every consent request crossed the Atlantic twice. They now run in Dublin.
  10. Withdrawal left cookies behind. c15t reloads the page when consent is withdrawn, which stops scripts, but it deletes nothing unless told which cookies each category owns. _ga survived a withdrawal with 400 days left to run. Each site now lists its tracking cookies under clearOnRevocation.

How to check it works

The network log is the test that matters. It is worth doing on each site after every change to tracking:

  • a fresh browser profile, recording every request before any click, should show no analytics or advertising hosts;
  • after “reject”, nothing new should load, and the choice should survive a reload;
  • after “accept”, the tags should load, and the choice should appear in the database with the right policy version;
  • the settings link in the footer should reopen the dialog and allow the choice to be withdrawn;
  • after a withdrawal, the page should reload, the tracking cookies should be gone and the database should hold a new row rather than a changed one.
Verification checklist: before any click no analytics or advertising hosts; after reject one save to /api/consent and the choice survives a reload; after accept the tags load once; each choice is one database row with the policy version and no IP; the footer link reopens the dialog; banner checked on phone and desktop.
Fig. 04: What to check after every change to tracking, and what each failure usually means.
select c."subjectId", c."consentAction", c."givenAt",
       p."version" as policy_version,      -- should match the policy you published
       c."ipAddress", c."userAgent"         -- expect NULL in both, on every row
from c15t_site_a.consent c
left join c15t_site_a."consentPolicy" p on p.id = c."policyId"
order by c."givenAt" desc
limit 5;

Handing the legwork to an AI coding agent

An AI coding agent such as Claude Code or Cursor can do nearly all of this: the audit, the code, the database schema and the browser tests. Three things stay with a person: creating the Supabase project and the database logins’ passwords, adding the environment variables in Vercel, and deciding when to deploy. The prompt below is the one I would use today, with the lessons built in; the <…> placeholders need replacing.

Goal: proper GDPR/PECR cookie consent on my headless Astro site <www.example.com> (Vercel):
a banner that matches the site's design, tags that wait for consent, and a server-side record
of every choice (GDPR art. 7(1)). Self-hosted c15t v3, records in my Supabase Postgres.

How to work:
1. Audit the LIVE site first and show me the results before changing anything:
   - fresh browser profile; record every request and cookie before any click, after "reject"
     and after "accept" (a visible banner proves nothing);
   - list every third-party tag in the code (GA4, Google Ads, Meta, embeds, fonts) and how it
     is loaded today; check Google Consent Mode is not in "advanced" mode;
   - check I am testing MY domain, not a lookalike.
2. Database: one schema and one login role per site (c15t_<site>), usable only by that role,
   revoked from public/anon/authenticated. Give me the SQL to run, or apply it with a pre-hashed
   SCRAM password so the plaintext never appears in chat. Passwords go in a file I keep.
3. Backend: @c15t/backend as an on-demand route at /api/consent (NOT /api/c15t, which the Astro
   integration reserves). Pin one `effect` version for the backend and @effect/sql-pg.
   - Connect with TLS required and Supabase's root CA pinned, verification ON. The driver
     connects unencrypted by default; never disable certificate checks to make it work.
   - Policy: europeOptIn() widened with policyMatchers.default() so every visitor gets opt-in
     (EU/UK establishment); proof WITHOUT IP address and user agent.
   - Run migrations through the session pooler (5432); the site uses the transaction pooler (6543).
   - Tell me to set the Vercel function region next to the database (Dublin for eu-west-1).
4. Front end: c15t() integration; hosted() for prerendered sites, manifest({ source: 'runtime' })
   for server output. Import components from @c15t/astro/components. ConsentScript in <head>,
   banner and dialog on every page, "Cookie settings" link in the footer.
   - Design: the site's own colours, fonts and corner radius; accept and reject equally
     prominent; no "Secured by" tag; long labels must wrap inside the dialog.
   - Copy in the site's languages, plain and specific about what each category does.
5. Tags load only after consent (load the script itself on consent, not just a Consent Mode flag).
   List each category's cookies under clearOnRevocation so a withdrawal deletes them.
6. Test a production build locally against a separate TEST schema, never a live one: banner
   on desktop and mobile, dialog, nothing before consent, reject survives a reload, accept and
   reject each add one row with no IP, a withdrawal adds a row and deletes the tracking cookies.
   Show me screenshots. Never delete rows from a live consent table: it is evidence.
   Retention: a function in each schema that deletes records 3 years after they expire; give me
   the SQL to schedule it nightly rather than scheduling it yourself.
7. Make sure build output (.vercel/) is git-ignored. Don't commit or push; tell me which files
   changed and which environment variables to set (C15T_DATABASE_URL, PUBLIC_C15T_BACKEND_URL).

Never: print passwords or connection strings in chat, store IP addresses, weaken TLS, or change
DNS, Vercel or Supabase settings without asking me first.

Three habits make the collaboration work:

  • ask for the audit before any code, so that the plan starts from what the live site actually does;
  • keep secrets out of the conversation: the agent can read a password file and pass values straight to a command without ever printing them;
  • ask it to save what it learned, such as the defaults that bit and the fixes that held, so that the next site starts from a checklist rather than from scratch.

The broader point

Rebuilding the banner is the easy part of leaving WordPress. The law asks for the record behind it, and a headless site has to build that record itself. The defaults of any tool deserve the same scrutiny as the code around them: here, two of them would have sent a password unencrypted and stored every visitor’s IP address.

Found this useful?

The monkeys run on bananas. If this saved you an outage or two, feed one.

New articles appear here when a project is finished, or when something has broken in a way worth writing up. They are also in the RSS feed, and this one may help someone about to make the same mistakes.

Share this article

Tap image to zoom · ✕ or Esc to close