Skip to main content

SDK Events

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(
'illow: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:

illow:widget_ready

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

Data

PropertyTypeRequired?Description
isOpenbooleanYesTrue if the UI is being shown. False if the icon or nothing at all is rendered.
hasPreviousConsentbooleanYesTrue if there is an existing consent given when loading the widget.
gpcbooleanNoTrue if the Global Privacy Control is enabled. False if it is disabled. Undefined if the setting does not exist.
bannerTypestringYesThe type of banner loaded. It can be 'global', 'gdprBanner', 'ccpaBanner'.
isIabEnabledbooleanYesTrue if IAB TCF v2.2 and Google Additional Consent Mode are enabled.
uiSettingsuiSettings ObjectYesSome of the UI settings such as positioning, blur background, etc.
uiSettings Object
PropertyTypeRequired?Description
positioningstringYesThe widget's position. Can be 'top', 'bottom', 'squaredLeft', 'squaredRight', 'squaredCentered'.
isIconEnabledbooleanYesTrue if the icon will be shown when the widget is closed. False otherwise.
isNoticeModebooleanYesTrue if the widget will not be shown on page load and the only way of opening it is by calling showWidget
isBlurBackgroundEnabledbooleanYesTrue if the background blurs when the widget is open.
languagestringYesThe two-lowered-cased-letter ISO code of the language used.

illow:widget_opened

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

illow:widget_closed

It is fired when the UI is closed.

illow:consent_set

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

Data

PropertyTypeRequired?Description
consent-idstringYesThe auto-generated ID created when the consent was given.
userIdstringNoThe User ID added when identifying the user.
marketingbooleanYesTrue if consent for marketing purposes was given.
preferencesbooleanYesTrue if consent for preferences purposes was given.
statisticsbooleanYesTrue if consent for statistics purposes was given.
optedInbooleanYesTrue if consent for 'Don't sell my data' purposes was given.

illow:identity_added

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

Data

PropertyTypeRequired?Description
userIdstringYesThe User ID added when identifying the user.

illow:identity_removed

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

illow:language_changed

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

Data

PropertyTypeRequired?Description
languagestringYesThe two-lowered-cased-letter ISO code of the language used.

illow:widget_refreshed

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