Skip to main content
All CollectionsOnline BookingData Analytics Integration
Advanced analytics integration with Online Booking
Advanced analytics integration with Online Booking

How to integrate event tracking such as Google Analytics

Jessica Magri avatar
Written by Jessica Magri
Updated over a week ago

The Semble Online Booking iFrame is designed to be embedded directly into the website of the practice. If this website makes use of a complex analytics setup it's important for events from the iFrame to be shared with the parent. This is why the Semble Online Booking iFrame broadcasts several events that developers can listen to in order to update their chosen analytics tool. This article describes a basic implementation.

You can start with some boilerplate HTML in a basic file called index.html:

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>Example Semble Integration</title>
<!-- page content -->

Now let's add a body! Go to your Semble account and get the iFrame link for an online booking configuration:

Now change the body tags to look like this:

<h1>Semble iFrame</h1>
<iframe src= width="100%" height="800" frameborder="0" scrolling="auto"></iframe>

If you open the file with your preferred browser you should see something like this:

Now let's add some Javascript in the head section of the index.html file:

window.addEventListener("message",(event) => {

if (event.origin!=="") {
} else {
const {data} = event;
if (!data.bookingStatus) return;

switch (data.bookingStatus) {
case 'selecting':
console.log('The widget has loaded but the user has not yet made a selection');
case 'selected':
console.log('The user selected a slot');
console.log(`Duration of selected slot is ${data.bookingDuration}`);
console.log(`Time of selected slot ${data.bookingStart}`);
console.log(`Location of selected slot ${data.location}`);
console.log(`Practitioner of selected slot ${data.practitioner}`);
console.log(`Product name of selected slot ${data.productName}`);
console.log(`Product price name of selected slot ${data.productPrice}`);

//you can send these details to any analytics tool of your choice here


case 'booked':
console.log('The user booked a slot');
console.log(`Duration of booked slot is ${data.bookingDuration}`);
console.log(`Time of booked slot ${data.bookingStart}`);
console.log(`Location of booked slot ${data.location}`);
console.log(`Practitioner of booked slot ${data.practitioner}`);
console.log(`Product name of booked slot ${data.productName}`);
console.log(`Product price name of booked slot ${data.productPrice}`);

//you can send these details to any analytics tool of your choice here


Refresh the file and you should see a log on the console as soo as the page loads. Now select a booking and you will see another series of logs. Finally, make a booking and a further series of logs will appear.

Some considerations.

  1. You will need to know how to manually send events to your analytics platform in order to forward the Semble events.

  2. You can mix our event data with any of your tracking data such as client IDs and lead referral data.

  3. It's easier to work with a Semble online booking configuration that does not redirect the user to a new page but it's not a requirement.

Did this answer your question?