Skip to content

Events Documentation

Consent Pro V2 emits integration events through window.dataLayer for analytics and tag-manager workflows.

Table of Contents

Overview

In the current V2 public API:

  • Event listener methods like on, off, once, and subscribe are not exposed on window.FinsweetConsentPro.
  • Consent lifecycle signals are emitted as dataLayer events.

GTM dataLayer Events

Consent Pro pushes the following events to window.dataLayer:

Fired whenever consent choices are applied or changed.

essential-activated

Fired once, when essential is active.

analytics-activated

Fired once, when analytics is active.

marketing-activated

Fired once, when marketing is active.

personalization-activated

Fired once, when personalization is active.

uncategorized-activated

Fired once, when all categories are active.

How to Use in GTM

  1. Create a Custom Event trigger in Google Tag Manager.
  2. Set the event name (for example, consent-updated).
  3. Attach the trigger to tags that should run for that consent state.

Repeat per event as needed.

How to Listen in JavaScript

Inspect events already pushed

javascript
const consentEvents = (window.dataLayer || []).filter((item) => typeof item === 'object' && item && 'event' in item);

console.log(consentEvents);

Observe future dataLayer.push calls

javascript
window.dataLayer = window.dataLayer || [];

const originalPush = window.dataLayer.push.bind(window.dataLayer);
window.dataLayer.push = (...items) => {
  items.forEach((item) => {
    if (typeof item === 'object' && item?.event) {
      console.log('[ConsentPro event]', item.event, item);
    }
  });

  return originalPush(...items);
};