Skip to main content

ILO events

Through Avacy it is also possible to customize the actions to be taken when a specific event is triggered, such as when consent is provided by a user.

The Framework integrated within Avacy provides a series of events that can be listened to at window level on the web page:

Event NameDescription
oil_optin_doneWhen a user opts in
oil_optin_done_button_clickedWhen a user opts-in by clicking the main button of the banner
oil_click_advanced_settingsWhen a user clicks advanced settings
oil_has_optedinEvery page load, when a user has already opted-in
oil_shownWhen the Cookie Banner is shown

There are basically 2 methods to use the listed events:

  1. Via an exposed API: window.AVACY.isInCollection(); By passing one of these events to the function, it will return a Boolean presence value.

Example: Let's check if the oil_optin_done event is raised.

 window.AVACY.isInCollection('oil_optin_done');

With this method the presence or absence of the event is checked at any time.

  1. Adding an Event Listener to the window and listening for the message event.

Simply check whether the required event is present in the message.data. Example: Let's check if the oil_optin_done event is raised.

window.addEventListener('message', message => {
    if(message.data == "oil_optin_done") {
        console.log("Optin Effettuato")
    } else {
        console.log('Optin Non Effettuato')
    }
});

With this method it is possible to react to the emitted event.