Chuyển đến nội dung

Core concepts

Analytics connectors

Pass the visitor's choice to your analytics tool and report how visitors answer the banner.


Switch connectors on under Advanced Settings → Analytics connectors. The loader only talks to tools it finds on the page; it never loads one for you.

Consent signals

The visitor's Analytics choice goes into the tool's own consent API: on at consent, off at refusal or withdrawal, and re-applied on every page, including for tools that load late. Matomo is held from its first call. The other tools can send a first hit before the loader reaches them, so start them opted out in their own setup — PostHog opt_out_capturing_by_default, Mixpanel opt_out_tracking_by_default, Amplitude optOut, Piano's default consent mode — or keep their tag blocked with data-cc-category; the connector then switches them on at consent.

  • Matomo — requireConsent until Analytics is allowed, then setConsentGiven on each page; a withdrawal calls forgetConsentGiven. Matomo's own remembered consent is cleared, so a re-prompt holds it again. The requirement has to come before Matomo's own tracking calls, so with Matomo on, install the loader first in <head> without defer.
  • Piano Analytics — pa.consent.setMode: opt-in when allowed, otherwise opt-out.
  • PostHog — opt_in_capturing / opt_out_capturing, only when PostHog's own state differs (each opt-in logs an event there).
  • Mixpanel — opt_in_tracking / opt_out_tracking, on the same rule.
  • Amplitude — setOptOut.

By default Matomo measures nothing and Piano is opt-out until Analytics is allowed. Exempt measurement switches Matomo to cookieless tracking (requireCookieConsent) and Piano to essential mode meanwhile. That follows the French CNIL's audience-measurement exemption and requires the tool to be configured for it; other regulators may not accept it.

Consent events

With consent events on, the banner being shown and each decision are reported as an action — shown, accept_all, reject_all, custom, gpc or do_not_sell — with its source (banner, gpc, tcf, …).

  • Plausible — plausible("Cookie consent", { props: { action, source } }). Add a custom event goal named Cookie consent in Plausible to see it.
  • Umami — umami.track("cookie-consent", { action, source }).
  • Fathom — fathom.trackEvent("cookie consent: <action>").
  • GA4, Matomo, PostHog, Mixpanel and Amplitude — only while the Analytics category is allowed: GA4 as the cookie_consent event (consent_action, consent_source), Matomo as trackEvent("Cookie consent", action, source), the others as Cookie consent / cookie_consent with action and source.
A refusal is never reported to a cookie-based tool: telling it would be the processing the visitor just refused. Your response rate, refusals included, is on the Reports page regardless.