Case study

Consent Orchestration Before Analytics

Why consent was built as a reusable gate before any analytics tool was connected.

This site4 implementation tools
The CookieConsent v3 site, by Orest Bida

This project needs analytics later, but it does not need analytics first.

That distinction is important. If Matomo or PostHog enters the codebase before a clear consent contract exists, the repo starts teaching the wrong lesson: privacy becomes an integration detail instead of a system boundary.

The rule

For v0, the consent model exposes only three categories:

  • necessary
  • analytics
  • media

That keeps the public contract explicit and small. It is enough to cover cookies, no-op analytics placeholders, and iframe-based embeds.

The implementation choice

The frontend combines two responsibilities:

  • CookieConsent manages user preferences, persistence, and the modal UX.
  • IframeManager prevents third-party embeds from loading until the matching category is accepted.

An internal registry sits between them so future providers do not have to know anything about the UI layer.

Why this is better than wiring a provider directly

It keeps provider churn cheap.

A later analytics spec can add Matomo or PostHog adapters without rethinking the consent categories, footer actions, or media gating model. The compliance logic stays readable because it is centralized.