PrivacyKit Web Components

Public web component documentation for consent-dialog, consent-guard, consent-missing, and compliance-monitor.

Table of Contents





<compliance-monitor>

Compliance Monitor observes outgoing requests and validates consent guard coverage on your live website, surfacing unmanaged trackers and regressions introduced by website changes. Inactive by default, it remains invisible to visitors and is safe to ship in production.

AttributeTypeDefault / RequiredDescription
debugbooleanfalseEnables the Compliance Monitor panel on page load. For development environments only.
delaynumber5000Network observation window (in milliseconds) before the Compliance Monitor begins validating endpoint usage and consent guard coverage.
ignore-first-party-subdomainsbooleantrueWhen true, requests to subdomains of the current domain are silently ignored.
fab-positionleft | rightrightControls which side of the viewport the compliance monitor FAB is pinned to.

Example

HTML
<compliance-monitor debug delay="5000" ignore-first-party-subdomains="true" fab-position="left"></compliance-monitor>

Compliance Monitor remains hidden from visitors even when included in the production bundle. The recommended way to activate it on a live website is to append ?privacykit=monitor to the URL — it activates the monitor only for that browser session, leaving the visitor experience unaffected.

Toggle programmatically:

TypeScriptAPI Reference
window.PrivacyKit?.toggleComplianceMonitor();

CSS Snippets

Avoid flickering before the web components finish loading. Without this snippet the slotted or guarded HTML can flash briefly when:

  1. consent-dialog can flash briefly if slotted elements are used and if they render before the component definition loads.
  2. consent-guard can flash briefly if it's used for conditional HTML and it renders before the component activates.
  3. consent-missing can flash briefly if consent-missing is used and it renders before the component activates.

Add styling in your light DOM to avoid flickering.

NPM
CSS
consent-dialog:not(:defined) [slot] {
  display: none;
}

consent-guard:not([active]) {
  display: none;
}

consent-missing:not([active]) {
  display: none;
}