What this layer controls
- Which scripts load, on which pages, in which order, and at what weight
- Whether a tag can fire before consent is recorded
- The audit trail of what was consented to and when
- Blast radius when one vendor’s script breaks the page
What it looks like when it is wrong
These are the symptoms that show up in a marketing report or a Monday meeting. Each one has a technical cause in this layer, and each is cheaper to fix before it has a quarter of history behind it.
- Consent banner appears after analytics has already set cookies
- Nobody can list the tags running on the site without a browser extension
- One marketing script is the largest single contributor to LCP
- Removing a vendor leaves orphan tags firing into the void
- The consent record cannot be produced for a specific date during an audit
An open-source stack for this layer
Every project below is open source and self-hostable, with the licence the project publishes today. This is a reference build, not a recommendation to run all of it: pick the layers your stack is missing.
| Layer | Project | Licence | What it does |
|---|---|---|---|
| Consent | Klaro | BSD-3-Clause | Consent state, categories, and blocking of tags until permission exists. |
| Consent (alt) | Cookiebot-compatible open CMPs | varies | If you must match a vendor's IAB TCF API, verify licence and self-host support first. |
| Tag loading | Matomo Tag Manager | GPL-3.0 | Self-hosted container with triggers, variables and a preview mode. |
| Script budget | Lighthouse CI | Apache-2.0 | Fails the build when total JS bytes or third-party connections exceed the budget. |
| Inventory | OpenCookieDatabase | Apache-2.0 / CC | Maps observed cookies and domains to named vendors so the inventory is generated, not guessed. |
Evaluation checklist
Answer each of these about your current stack. A ‘no’ is a work item, and the count is a fair summary of the layer’s health.
- Can you produce the complete list of scripts on every template, with owners?
- Does the CMP block by default and fire only after an explicit choice?
- Is the consent decision stored server-side with a timestamp and version?
- Is there a script budget enforced in CI, not a review comment?
- Does removing a vendor remove its tags, its cookies and its domain from the allowlist?
- Is the consent banner keyboard accessible and readable at 320px?
What to instrument
Numbers that make the layer’s health visible before a customer complains.
- Tags firing before consent (target: zero)
- Third-party domains per template
- JS bytes from marketing tags as a share of total JS
- Consent opt-in rate by category, and its trend after any change
Where this fits
Scope. This page describes the category and an open-source way to build it. It does not publish 5 Kings’ internal method, client data or vendor terms, and it is not an endorsement of every project listed: check the licence and the maintenance activity against your own constraints before you adopt one.