When Google Analytics and/or Meta Pixel tracking are configured for a booking engine, these trigger by default when the booking engine (or review booking form) loads on your webpage. Adding a custom JavaScript callback to the booking engine makes it possible to control this triggering. This can be useful in combination with a cookie consent banner that has not yet been accepted, or if you only want to trigger specific events.
Note: This requires some basic knowledge of Javascript callbacks. Consult your web developer if you need any assistance.
Before You Start
- Add a custom script to your webpage.
Controlling the Triggering in the Booking Engine
Adding a Javascript Callback
- Return
- “false” from your custom script to skip the trigger for a specific event.
- any other value (or an empty response) to trigger the tracking.
- In Sirvoy, go to Settings -> Booking engines.
- Click the three dots adjacent to the booking engine you want.
- In the drop-down list, click “How to install.”
- Click “Advanced.”
Your function is now called for each step the guest takes in the booking engine.
Note: To add a Javascript Callback to the Review Booking Form, go to Settings -> Guest portal -> Install.
Events Fired in the Booking Engine Flow:
- page_code_required – Fires when the form to enter a coupon code is displayed (if that is required for your booking engine).
- page_search – Fires when the search form is displayed.
- page_results – Fires when the search results page is displayed.
- page_details – Fires when the guest details input form is displayed.
- 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.
- 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.
- booking_completed – Fires when a booking is completed on the confirmation page.
Note: When using a custom image gallery on the search results page, the events “gallery_init” and “gallery_open” will also fire.
Controlling the Triggering in the Review Booking Form
Adding a Javascript Callback
- Return
- “false” from your custom script to skip the trigger for a specific event.
- any other value (or an empty response) to trigger the tracking.
- In Sirvoy, go to Settings -> Guest portal -> Install, and click “Advanced.”
- Fill in the name of the function you want to call in the field “Javascript callback function.”
- Copy the code from “Copy this code.”
- Add the code to your webpage to install the review booking form.
Your function is now called for each step the guest takes in the review booking form.
Events Fired in the Review Booking Form Flow:
- page_review_search – Fires when the review search form is displayed.
- page_review_booking – Fires when the review booking page is displayed.
- page_review_pending – Fires after an optional payment is made through the review form. After this event the page displays the review booking form again and the “page_review_booking” event is fired again.
Before You Go
Explore the available events and their associated data with the code below by printing out all the events in the web developer console:
<script>
function customEventHandler(data) {
console.log("Got Sirvoy custom JS event: " + data.event);
console.dir(data);
}
</script>