Skip to content
vviinn DocsDocs Beta

Widget Events

Every vviinn widget emits events that you can listen to with document.addEventListener().

The following props are available for each event:

  • campaignTypeId
  • campaignTypeName
  • widgetId (if exists)
  • widgetVersion
Name Description Available on
vviinnWidgetLoad Triggered when the widget is loaded and initialized. For vviinn-vpr-button (Product AI recommendation) it triggers in the background when the button is rendered. For vviinn-vps-button (Product AI search) it triggers after initializing, but only after clicking the button. Recommendation (Button, Widget)
Search (Button, Widget)
vviinnWidgetOpen Triggered by clicking on the widget button, right after opening the modal. Recommendation Button
Search Button
vviinnWidgetClose Triggered by closing the widget. Recommendation Button
Search (Button, Widget)
document.addEventListener("vviinnWidgetLoad", ({ detail }) => {
console.log(detail);
});
// Output: Search Modal
{
"campaignTypeId": "VPS",
"campaignTypeName": "Visual Search",
"widgetId": "my-search-widget",
"widgetVersion": "2.85.0"
}
// Output: One-Click Discovery
{
"campaignTypeId": "VPR",
"campaignTypeName": "Similar Products",
"widgetVersion": "2.87.0"
}