Skip to main content

Widget opened

This event is triggered when a widget is opened, indicating that the widget is active and ready for interaction.

Event details​

When the widgetOpened event occurs, the received event.detail object includes the following properties:

WidgetOpenedSdkEvent
event
Properties
readonly typeWIDGET_OPENED
Event type, always "widgetOpened"
readonly widgetNamestring
Name of the widget that was opened

Usage example​

Ensure the SDK is ready before setting up the widgetOpened event listener:

function onSdkReady() {
const eventName = window.gw.sdk.common.events.WIDGET_OPENED;

window.gw.sdk.on(eventName, (event) => {
console.log(event.detail);
});
}

if (window.gw && window.gw.sdk) {
onSdkReady();
} else {
document.addEventListener("gwSdkReady", onSdkReady);
}

// Example output:
// {type: 'widgetOpened', widgetName: 'ReviewsDrawerWidget'}

Possible widgetName values​

  • ReviewsFormModalWidget
  • ReviewsDrawerWidget
  • RewardsPopUpWidget
  • WishlistDrawerWidget