Wix Events events are fired on your site's backend when certain actions occur to Wix Events. You can write event handlers that react to these events. Event handler functions receive data that corresponds to the event that fired. Use event handlers to create custom responses to Wix Events events.
To add an activity counters event handler, add an events.js file to the Backend section of your site if one does not already exist. All event handler functions for your site are defined in this file.
Event handler functions are defined using the following pattern:
For example, an event handler that handles the event cancellation looks like this:
Note: Backend events don't work when previewing your site.
A backend event that fires when a Guest is created.
The onGuestCreated()
event handler runs when a Guest is created on your site. The received GuestCreated
object contains information about the new guest.
Note: Backend events are not fired when previewing your site.
Information about the created guest and onGuestCreated
event.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
A backend event that fires when a Guest is deleted.
The onGuestDeleted()
event handler runs when a Guest is deleted from your site. The received GuestDeleted
object contains information about the deleted guest.
Note: Backend events are not fired when previewing your site.
Information about the onGuestDeleted
event.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
A backend event that fires when a Guest is updated.
The onGuestUpdated()
event handler runs when a Guest is updated from your site. The received GuestUpdated
object contains information about the updated guest.
Note: Backend events are not fired when previewing your site.
Information about the updated guest and onGuestUpdated
event.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
A backend event that fires when a Policy is created.
The onPolicyCreated()
event handler runs when a Policy is created in your site. The received PolicyCreated
object contains information about the new policy.
Note: Backend events are not fired when previewing your site.
Information about the created policy and onPolicyCreated
event.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
A backend event that fires when a Policy is deleted.
The onPolicyDeleted()
event handler runs when a Policy is deleted in your site. The received PolicyDeleted
object contains information about the deleted policy.
Note: Backend events are not fired when previewing your site.
Information about the onPolicyDeleted
event.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
A backend event that fires when a Policy is updated.
The onPolicyUpdated()
event handler runs when a Policy is updated in your site. The received PolicyUpdated
object contains information about the updated policy.
Note: Backend events are not fired when previewing your site.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
function wixEventsV3_onEventCanceled(event: EventCanceled): void;
export function wixEventsV3_onEventCanceled(event) {
const eventId = event.metadata.id;
const entityId = event.data.event._id;
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.