SDK Events

Prev Next

As mentioned before, throughout the SDK lifecycle some events will be fired. These will be in the form of Custom Events, supported by all the browsers. Also, some of them will carry data within the detail property that will enable you to deepen any integration you need to do. You can listen to any of them with a regular listener added at the window object:

window.addEventListener(
  'bigidcmp:widget_ready',
  (event) => console.log('The widget is ready!', event.detail),
);

You will find here the full list of events fired by the SDK. Remember that all data objects will always be included in the detail property of the event:

bigidcmp:widget_ready

It is fired when the UI and SDK are loaded and ready.

Data

Property

Type

Required?

Description

isOpen

boolean

Yes

True if the UI is being shown. False if the icon or nothing at all is rendered.

hasPreviousConsent

boolean

Yes

True if there is an existing consent given when loading the widget.

gpc

boolean

No

True if the Global Privacy Control is enabled. False if it is disabled. Undefined if the setting does not exist.

bannerType

string

Yes

The type of banner loaded. It can be 'global', 'gdprBanner', 'ccpaBanner'.

isIabEnabled

boolean

Yes

True if IAB TCF v2.2 and Google Additional Consent Mode are enabled.

uiSettings

uiSettings Object

Yes

Some of the UI settings such as positioning, blur background, etc.

uiSettings Object

Property

Type

Required?

Description

positioning

string

Yes

The widget's position. Can be 'top', 'bottom', 'squaredLeft', 'squaredRight', 'squaredCentered'.

isIconEnabled

boolean

Yes

True if the icon will be shown when the widget is closed. False otherwise.

isNoticeMode

boolean

Yes

True if the widget will not be shown on page load and the only way of opening it is by calling showWidget

isBlurBackgroundEnabled

boolean

Yes

True if the background blurs when the widget is open.

language

string

Yes

The two-lowered-cased-letter ISO code of the language used.

bigidcmp:widget_opened

It is fired when the UI is opened by clicking the icon or calling the showWidget method.

bigidcmp:widget_closed

It is fired when the UI is closed.

bigidcmp:consent_set

It is fired when the consent is set by the user.

Data

Property

Type

Required?

Description

consent-id

string

Yes

The auto-generated ID created when the consent was given.

userId

string

No

The User ID added when identifying the user.

marketing

boolean

Yes

True if consent for marketing purposes was given.

preferences

boolean

Yes

True if consent for preferences purposes was given.

statistics

boolean

Yes

True if consent for statistics purposes was given.

optedIn

boolean

Yes

True if consent for 'Don't sell my data' purposes was given.

bigidcmp:identity_added

It is fired when the identify method is called and the consent is now cross-device.

Data

Property

Type

Required?

Description

userId

string

Yes

The User ID added when identifying the user.

bigidcmp:identity_removed

It is fired when the removeIdentity method is called and the identity is removed.

bigidcmp:language_changed

It is fired when the setLanguage method is called and the language is changed.

Data

Property

Type

Required?

Description

language

string

Yes

The two-lowered-cased-letter ISO code of the language used.

bigidcmp:widget_refreshed

It is fired when the refreshWidget method is called and the UI is refreshed.