The consent check someone missed
Analytics that fires on page load, with a banner bolted on later, needs a guard at every call site. One missed guard is a compliance incident.
Know what broke and what's used, without spying on anyone.
See what your users do and what breaks, from day one. Analytics stays completely silent until a user says yes to tracking. And when something fails, the user gets a short code your support team can actually look up.
0
tracking events before the user says yes
1
place where all error codes live
2
tools that vanish from the build if unset
Without a shared foundation, every team rebuilds these edge cases — differently.
Analytics that fires on page load, with a banner bolted on later, needs a guard at every call site. One missed guard is a compliance incident.
A user reports a failure with no reference, or worse, pastes a raw stack trace. Support has nothing stable to match against a real captured event.
SDKs that assume their keys exist crash local development, ship dead bundle weight, or quietly behave differently between environments.
The mechanism end to end, as implemented in the repository.
Consent comes first
Every tracking call checks the user's analytics cookie choice. On a yes, the tracker loads lazily, and a listener catches users who say yes later in the session.
Errors get captured with context
Error reporting filters out noise and tags each event with structured context like org, project, and job. In development, events log locally instead of being sent.
Users get a stable reference
Every failure maps through one registry to a support reference like APP-CAPACITY-001 and a safe public message. A released reference always means the same thing, forever.
Missing keys cost nothing
No analytics or error-reporting keys configured? Every helper becomes a no-op and the build drops the unused tools entirely.
Interactive example
This walkthrough demonstrates the implemented backend contract without using an account, credentials, or provider calls.
Interactive example
Deterministic sample data only. No account, provider, or network connection is used by the interaction.
Highlights
Analytics is a silent no-op until the user accepts the analytics cookie, even if they say yes mid-session.
Error reports are tagged with the org, project, job, and AI details, so you can triage without digging through raw data.
Every API error maps to a short support code and a safe public message users can quote in a ticket.
Engineering guarantees
Error reporting is separate from analytics consent, and the kit doesn't pretend otherwise. The privacy and retention policy for error data, and what your context tags may contain, is still yours to set.
The boundary above is code, not a claim. These files carry the contract:
src/lib/analytics.tssrc/lib/sentry.tssrc/registries/error-codes.tsdocs/ERROR-CODES.mdThese capabilities share contracts and boundaries with this one.
The docs describe the same contracts this page demonstrates.