More Configurations
Events
An event is exposed to the window
when the modal open state changes.
You just need to subscribe to the window
event stories-modal-state-change
:
<script>
window.addEventListener('stories-modal-state-change', (event) => doSomething(event.detail));
</script>
Event Details
Key | Type | Description |
---|---|---|
modalId | string | An id to help you identified the modal which state has changed if needed |
open | Boolean | The new state open the modal. true if a story has been opened, false if the modal has been closed |
Audiences
You can define audiences for your widget. Those audiences will be used to target the content of the widget. You can define audiences by adding new slots to your widget in the studio.
To change audiences of the widget, you can add the following code to your integration :
<script>
function sendAudienceData(a) {
(window.jDataLayer = window.jDataLayer || []), window.jDataLayer.push({ type: 'audience', data: a });
}
sendAudienceData({
age: 25,
location: "Paris",
});
</script>
You can use any key you want to define your audiences, and configure the conditions in the studio.