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 Name | Description |
oil_optin_done | When a user opts in |
oil_optin_done_button_clicked | When a user opts-in by clicking the main button of the banner |
oil_click_advanced_settings | When a user clicks advanced settings |
oil_has_optedin | Every page load, when a user has already opted-in |
oil_shown | When the Cookie Banner is shown |
There are basically 2 methods to use the listed events:
- 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.
- 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.