Skip to main content

consentChanged CMP Event Reference

Overview

Our CMP emits a browser CustomEvent named consentChanged on window whenever consent settings are emitted or updated.

  • Event target: window
  • Event type: CustomEvent
  • Event name: consentChanged
  • Event detail: consent settings object (event.detail)
  • bubbles: true

The event detail is a snapshot of the current consent state.

If you don't have access to the event payload, or you're otherwise looking for consent-specific event signals, we also support a number of one-time-per-page-load consent events that you can listen for by name to react to a specific consent change — or to the first-time-overall grant on a page.

Payload

The CMP emits consent settings with these fields:

FieldTypeDescription
clientIdstringPer-browser UUID used for consent record association
implicitbooleantrue when consent is implicit; false after explicit user choice (including an opt-out from the Privacy Center)
analyticsPermittedbooleanAnalytics consent signal
personalizationPermittedbooleanPersonalization consent signal
adsPermittedbooleanAdvertising consent signal
essentialPermittedbooleanAlways true
notOptedOutbooleantrue means consumer is not opted out of targeted advertising/data sale. false means the consumer is opted out. (in other words, this is a "true means permission" signal like the others)
informationalConsentBannerDismissedbooleanSet when the informational banner is dismissed

Example payload:

{
"clientId": "550e8400-e29b-41d4-a716-446655440000",
"implicit": false,
"analyticsPermitted": true,
"personalizationPermitted": true,
"adsPermitted": false,
"essentialPermitted": true,
"notOptedOut": false,
"informationalConsentBannerDismissed": false
}

When It Is Emitted

consentChanged can fire multiple times per page load.

1. During Polaris bootstrap

On every page load, Polaris emits the current consent state during initialization — the visitor's saved choice from a previous visit if one exists, or the regional default otherwise. For a returning visitor, this means their stored choice is replayed on each page load; the event is not limited to new banner interactions.

Notes:

  • This can happen very early.
  • Depending on script load order, listeners attached later might miss this first event. If your code may run after this emission, you can always read the current state synchronously from the polaris_consent_settings cookie instead.

Any user action or code path that updates consent emits consentChanged by default, including but not limited to:

  • Accept All / Reject All actions
  • Individual preference toggle changes (analytics/personalization/ads/targeted)
  • Opt-outs that are applied from the Privacy Center (us_privacy cookie) or GPC signal

3. Informational banner dismissal

When the informational banner is dismissed, CMP updates informationalConsentBannerDismissed and emits consentChanged.

Integration Example

<script>
window.addEventListener('consentChanged', (event) => {
const consent = event.detail || {};
// React to consent updates here.
// Example: enable/disable tags that are controlled outside of GTM, update in-page features, etc.
console.log('consentChanged', consent);
});
</script>

Implementation Notes

  • Treat event.detail as the source of truth for current consent state.
  • Do not assume the event fires only after user interaction.
  • Do not assume only one event per page load.
  • Attach listeners as early as possible if you must capture the first initialization emission.
  • If you need the consent state before your listener attaches (for example, at first render), read the polaris_consent_settings cookie synchronously. Server-rendered code can read the same cookie from the incoming request.