Events

Events can be subscribed in the widget code in the same way as adding parameters, using the cbk(key, value) method.

onNavigate event#

This event is triggered when a navigation is made, either by user interaction or by an automatic event. This also represents a change in the hash url.

cbk("onNavigate", function(navigation) {
console.log("Navigation was made", navigation);
});

The navigation argument will be an object with the following structure.

{
direction: "forward",
from: "service",
to: "calendar"
}
note

When this event is triggered the widget will automatically send page view events to Meta Pixel and Google Analytics, if they are present on the page.

onReserved event#

This event is triggered when a time slot is reserved. If this parameter is set, the specified method will be run with the booking properties as the only argument.

cbk("onReserved", function(booking) {
console.log("Booking reserved", booking);
});

The booking argument will be an object with the following structure.

{
bookingRef: "qAxDM5rz",
customer: {
name: "Full Name",
phone: "+46812345678",
email: "email@gmail.com"
},
date: "2021-04-30",
length: 60,
location: "Cliento AB",
locationId: "7DUdvNGJ5LXQK83UlWTJ1O",
price: 500,
resource: "Resource Name",
services: ["Service 1", "Service 2"],
time: "09:00"
}
note

A time slot is reserved when user has selected a time and entered their customer details. If the booking is not completed within 5 minutes, the time slot will be released.

onCompleted event#

This event is triggered when a booking is completed. If this parameter is set, the specified method will be run with the booking properties as the only argument.

cbk("onCompleted", function(booking) {
console.log("Booking completed", booking);
});

The booking argument will be an object with the following structure.

{
bookingRef: "qAxDM5rz",
customer: {
name: "Full Name",
phone: "+46812345678",
email: "email@gmail.com"
},
date: "2021-04-30",
length: 60,
location: "Cliento AB",
locationId: "7DUdvNGJ5LXQK83UlWTJ1O",
price: 500,
resource: "Resource Name",
services: ["Service 1", "Service 2"],
time: "09:00"
}
note

When this event is triggered the widget will automatically send purchase events to Meta Pixel and Google Analytics, if they are present on the page.