Blocks Widget Events

Add an event when you want to provide information about actions that happen in the widget to the site owner. For example, when a customer adds a product to the cart. 

To add a new event:

  1. Click the Widget API  icon.
  2. Click Add New Public Event or hover over Events and click the  icon. 

add new event

3.  Name your event and provide a description. 

4. Fire the event from your widget code.

Use this syntax:

Copy

Define the condition for firing the event and, optionally, send event data. For example:

Copy

5. You can catch your event from two places

  • From any site where your widget is installed.
  • From any widget of your app to which you added this widget as an inner widget.
Don't forget to document

Make sure to document your widget API by describing any property, event or function you add to it. These descriptions are available to Wix users who install your widget.

Did this help?