By specifying “data-callback” when including the Sirvoy widget, you will be able to catch events and run your own custom scripts (see example below). In most scenarios, you will only be interested in the ‘booking_completed’ event.

For booking flow these events will be fired:

  • page_code_required – fires on the form to enter the coupon code if that is required for your booking engine.
  • page_search – fires when displaying the search form. Extra data: “user_data” (arrivalDate, departureDate, totalAdults, category)
  • page_results – fires when displaying the search results. Extra data: “user_data” (same as page_search)
  • page_details – fires when displaying the guest details input form. Extra data: “user_data” (same as page_search)
  • page_pending – fires before the confirmation step, after returning from a payment provider or if you don’t use a payment provider after the page_details event. Extra data: “booking” (JSON representation of the booking)
  • page_confirmation fires on the confirmation step, after returning from a payment provider or if you don’t use a payment provider after the page_details event. Extra data: “booking” (JSON representation of the booking)
  • booking_completed – fires when booking is final and completed on confirmation page. This event is guaranteed to fire only once per booking, while for example you could have multiple “page_confirmation” or “page_pending” if the guest is making optional payments – once he is redirected back from the payment provider these events will fire again. Extra data: “booking” (JSON representation of the booking)

For review flow these events will be fired:

  • page_review_search – fires when displaying the review search form.
  • page_review_booking – fires when displaying the review booking page. Extra data: “booking” (JSON representation of the booking)
  • page_review_pending – fires after an optional payment made via review form, and after this event the page will display the review booking form again and the “page_review_booking” event fired again. Extra data: “booking” (JSON representation of the booking)

Below is an example that can be used to explore the different available events and associated data. Make sure to replace “data-form-id” with your own booking engine ID.



    <script>
        function customEventHandler(data)
        {
            console.log("Got Sirvoy custom JS event: " + data.event);
            console.dir(data);
        }
    </script>


<script async type="text/javascript" data-callback="customEventHandler" data-form-id="your-form-id-here" src="https://secured.sirvoy.com/widget/sirvoy.js"></script>


Note: The events gallery_init and gallery_open will also be fired when the image gallery is used on results page, see this article for details.