Introduction

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:

Copy

For example, an event handler that handles the event cancellation looks like this:

Copy

Note: Backend events don't work when previewing your site.

Did this help?

onGuestCreated( )


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.

Method Declaration
Copy
Method Parameters
eventGuestCreated

Information about the created guest and onGuestCreated event.

A backend event that occurs when a guest is created
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onGuestDeleted( )


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.

Method Declaration
Copy
Method Parameters
eventGuestDeleted

Information about the onGuestDeleted event.

A backend event that occurs when a guest is deleted
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onGuestUpdated( )


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.

Method Declaration
Copy
Method Parameters
eventGuestUpdated

Information about the updated guest and onGuestUpdated event.

A backend event that occurs when a guest is updated
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onPolicyCreated( )


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.

Method Declaration
Copy
Method Parameters
eventPolicyCreated

Information about the created policy and onPolicyCreated event.

A backend event that occurs when a policy is created
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onPolicyDeleted( )


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.

Method Declaration
Copy
Method Parameters
eventPolicyDeleted

Information about the onPolicyDeleted event.

A backend event that occurs when a policy is deleted
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onPolicyUpdated( )


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.

Method Declaration
Copy
Method Parameters
eventPolicyUpdated
A backend event that occurs when a policy is updated
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onEventCanceled( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Method Declaration
Copy
function wixEventsV3_onEventCanceled(event: EventCanceled): void;
Method Parameters
eventEventCanceled
onEventCanceled example
JavaScript
export function wixEventsV3_onEventCanceled(event) { const eventId = event.metadata.id; const entityId = event.data.event._id; }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?