View as Markdown

Consent

Consent is off by default. When you turn it on for a site, the same snippet also shows a cookie banner, and Erised collects nothing from a browser until the visitor grants the analytics category. Every choice is recorded, and a known person's choice shows on their profile.

Erised is consent tooling, not a compliance guarantee: whether you need consent, and for what, is your decision.

Turn it on

  1. In the app, Settings → Consent: enable it, then set the categories, texts, policy link and the look of the banner. The defaults are Necessary (always on), Analytics and Marketing, none pre-ticked; Reject all is as easy as Accept all.
  2. Add { consent: true } to the init call:
<script>
  window.cdp = window.cdp || [];
  window.cdp.push(['init', 'pk_live_YOUR_PUBLISHABLE_KEY', { consent: true }]);
</script>
<script async src="https://app.erised.run/sdk/v0.js"></script>

What happens

  • Before a choice: no anonymous id, no storage, no events. Only the banner.
  • Analytics granted: collection starts at once, without a reload.
  • Rejected: nothing is collected. The decline is recorded without any id.
  • Withdrawn: the withdrawal is recorded, then every Erised cookie and storage entry is deleted and collection stops.
  • The choice lives in the erised_consent cookie. It expires after 6 months by default (configurable, never more than 13), and changing the policy version asks again.

Visitors must be able to change their mind. Reopen the preferences from your footer:

document.querySelector('#cookie-settings')?.addEventListener('click', () => {
  cdp('showConsent');
});

Gate your own trackers

Erised never starts or blocks other scripts for you. Use the choice:

cdp('onConsent', (choice) => {
  if (choice?.categories.analytics) startMyAnalytics();
  else stopMyAnalytics();
});

cdp('consent') returns the current choice (or null); onConsent runs once at load when a choice exists, and on every change.

The server rule

Send an anonymousId on a server call only when the visitor granted analytics. Reading it from the erised_anonymous_id cookie follows the rule by itself: that cookie does not exist before consent. When it is absent, send the identify without it.