Skip to content
English
  • There are no suggestions because the search field is empty.

How to Add Bookassist Booking to a Website You Build

Connect a hotel's website to its Bookassist booking pages.

You add two scripts to every page and point each Book Now link straight at booking. This guide is for the web developer who builds and runs the hotel's site.

Read this first: you do not need a reservations page. Every Book Now link points straight at the booking address. When the guest clicks, the scripts add what the booking pages need.

Step-by-Step Instructions


1. Get the Hotel's Two Numbers

  1. Ask the hotel for its hotel_id and guide_id. Both are numbers and they never change. The hotel's account manager at Bookassist has them.
  2. Keep them ready: each piece of code below has a HOTEL_ID and a GUIDE_ID. Replace these with the hotel's numbers.

2. Add the Visit Script to Every Page

  1. Paste this block just before the closing tag on every page of the site.
  2. Replace Your Hotel Name, HOTEL_ID and GUIDE_ID. Leave hotel_group_id empty.
<script>
   var BA = BA || {};
   BA.account = "Your Hotel Name";
   BA.hotel_id = "HOTEL_ID";
   BA.hotel_group_id = "";
   BA.guide_id = "GUIDE_ID";
   (function() {
   var ba = document.createElement('script');
   ba.type = 'text/javascript'; ba.async = true;
   ba.src = '//dwxf316kii2pu.cloudfront.net/scripts/BA/rt-min.jsp';
   var s = document.getElementsByTagName('script')[0];
   s.parentNode.insertBefore(ba, s);
   })();
</script>

3. Add the Booking-Link Script to Every Page

  1. Paste this line into the of every page.
  2. Replace HOTEL_ID and GUIDE_ID. Keep the version number, @2.2.1, exactly as it is written here.
<script async src="https://unpkg.com/ba-js-rt@2.2.1/lib/vt.js?hotel_id=HOTEL_ID&guide_id=GUIDE_ID"></script>

 

4. Point Every Book Now Link Straight at Booking

  1. Set the address of every Book Now link on the site to the address below, with the hotel's two numbers in it.
  2. Add the class bkn-btn to each of those links, next to any classes your design already gives them. The booking-link script finds the links by this class.
<script async src="https://unpkg.com/ba-js-rt@2.2.1/lib/vt.js?hotel_id=HOTEL_ID&guide_id=GUIDE_ID"></script>

If the hotel has a booking address in its own name, such as reservations.yourhotel.com, this link takes the guest there automatically. You do not need to change it.

5. Connect Google Analytics 4

Skip this step if the hotel's site does not run Google Analytics 4. If it does, the hotel's GA4 property must list both domains. Only then does GA4 count the guest's visit to the site and to booking as one session.

  1. Open the hotel's GA4 property and go to Admin → Data streams. Choose the website's stream, then Configure tag settings.
  2. Configure your domains: add the hotel's own domain and bookassist.com. Write each one as the domain only, with no www. and no https://.
  3. List unwanted referrals: add the same two domains.

6. Check It Works

  1. Open the hotel's site in a private window and let the page finish loading.
  2. Hover over a Book Now link: its address now contains bas= and a long code. The booking-link script adds this for each visitor.
  3. Click Book Now: the hotel's booking page opens.
  4. If the site runs GA4, accept the cookie banner first, then click Book Now. The booking page's address now contains _gl=. If it does not, go back to step 5.
Pro-Tips & Troubleshooting
  • Never copy a Book Now link from the address bar or from the live page. Once the booking-link script has run, the link contains a code that belongs to the visitor who loaded the page. Build every link from the address in step 4.
  • A link that can take an id but not a class. Some plugins and popups build their own buttons. List the id of each of these buttons in a small script above the booking-link script. Each one is then treated like a bkn-btn link:
    <script>BA = window.BA || {}; BA.bkBtn = ['popupBookButton'];</script>
  • Buttons added after the page loads, by a menu or a popup, are found as they appear. They still need the class or a listed id.
  • Keep both scripts. They do different jobs. The one at the bottom of the page records visits to the website. The one in the head passes each visitor's details on to booking. The site needs both.

→ Next: How to Add a Booking Link — the extra details a Book Now address can carry, such as dates and offers