Integrating Google Analytics With Booking Button For Hotel Websites

Integrating Google Analytics With Booking Button For Hotel Websites

Many hotels are using the popular third party hotel booking system called TheBookingButton (TBB) however most are unaware of the benefits of integrating Google Analytics which allows hotels to track, understand and report on the performance or their website and digital marketing campaigns.

Think about this scenario, you’re the marketing manager of a major hotel and the director comes to you and asks you “how much money have we spent on Google advertising this month and what was our return on investment?“. If this question worries you and you currently can’t answer it, this tutorial is for you.

If you follow these steps you’ll be in the best position to confidently and quickly answer your Director with a clear breakdown of the revenue generated per channel in Google Analytics.

The Booking Button Transactions

This data is only possible when Google Analytics is integrated with The Booking Button correctly.

Getting Started

Most hotels already have a Google Analytics account and if that’s the case there is no need for you to create a new account.  However, if you don’t have one yet then the first thing you need to do is setup Google Analytics by heading over to the Google Analytics sign up page and running through the short setup.

Once you have your account you need to follow these steps to get your Google Analytics Account ID:

  1. Head to Admin in Google Analytics
  2. Under the Property Column select Property Settings
  3. Take note of the Google Analytics ID for your property i.e.UA-XXXXXXX-X

Now that you have your ID we need to inform Siteminder that we wish to configure advanced tracking with source attribution for your hotel. Email TheBookingButton support on [email protected] and include the following:

  • Your Google Analytics Account ID, (e.g. UA-XXXXXXX-X)
  • Your Booking Button client prefix. Usually the name of your property in lower case with dashes replacing any spaces.
    • i.e
  • Once TheBookingButton support confirms that your account has been updated, proceed to implementation.

Technical Setup

Step 1. Get your Google Analytics Tag

If you are using the current Universal Analytics tracking code, it will be similar to the snippet below. If you’re script doesn’t look like this we recommend you upgrade from classic to universal before you get started.

  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

  ga('create', '<INSERT TRACKING ID>', 'auto');  
  ga('send', 'pageview');


Step 2. Updating your Google Analytics code snippet

The next step is to update your Universal Analytics code to look like the following.

  • <Your GA Account ID> – insert your Google Analytics ID (e.g. UA-XXXXXXX-X) making sure to remove from the starting < to the closing >
  • <Your client prefix> – insert your BookingButton client prefix (e.g. diplomatmoteldirect) making sure to remove from the starting < to the closing >
<script src="//"></script>
<script type="text/javascript">
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
var tbb_ga = '<Your GA Account ID>';
var tbb_cid = '<Your client prefix>';
var tbb_domain = '';
ga('create', tbb_ga, {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', [tbb_domain], false, true);
ga('send', 'pageview');
ga(function(tracker) {
window.linker = window.linker || new window.gaplugins.Linker(tracker);
if(document.referrer.indexOf(document.domain)!=7) {
var e = document.createElement('iframe');
e.src = window.linker.decorate('//'+tbb_domain+'/'+tbb_cid+'/ga_proxy');
e.setAttribute('style', 'display:none');
var b = document.getElementsByTagName('body')[0];
// Automatically apply TBB prefix to thebookingbutton links
this.href = this.href.replace(new RegExp(tbb_domain+'/properties', 'i'), tbb_domain+'/'+tbb_cid+'/properties');

Now that you’ve got your updated script get your webmaster to add it to your site or copy the script yourself and place it into your website code. If you’re using WordPress normally the best place to put it is in your header.php file or you can also use a plugin.

Step 3 –  Enable Ecommerce Tracking in Google Analytics

If you want to see the eCommerce transactions in Google Analytics then you must first have eCommerce tracking switched on.

  1. Go to Admin in Google Analytics
  2. Go to the view column and select eCommerce settings
  3. Switch eCommerce from OFF to ON.
  4. Press next step
  5. Press submit


Step 4. Create a Filter to remove virtual page views

This is a very technical step and it’s simply a matter of going “OK, I can do that” and not necessarily a requirement that you understand why. Just know that it’s important and you should do it when setting up any hotel.

This is the explanation from Siteminder:

A virtual page view is generated by the cookie synchronisation process in the TheBookingButton tag. Create the following filter (at a view level) to remove this virtual page view to avoid inflating your page view and visit data.

  1. Go to Admin Google Analytics
  2. Find the view column and then select filters
  3. Call the filter “Remove cookie sync virtual pageview”
  4. Select filter type of custom
  5. Select Request URI as the Filter Field
  6. Add the following filter pattern “ga_proxy?” (without quotes)


Step 5. Check the default URL and referral exclusion list settings

Ensure you have the default URL of your site set correctly in the property settings section of Google Analytics as shown below.

  1. Select Admin in Google Analytics
  2. Go to the Property Column
  3. Select Property Settings
  4. Check the Default URL is correct.


Step 6. Add TheBookingButton as an Exclusion

For Universal Analytics accounts only, ensure you have the domain name of TheBookingButton set in the referral exclusion list for your Google Analytics property as shown below.

  1. Select Admin in Google Analytics
  2. Property column -> Js Tracking Info
  3. Referral exclusion list
  4. Add as an exclusion
  5. Select create


Step 6. Update TheBookingButton links on your website

Now you need to go through your existing site an update any links or call to actions on your website from the old links to the new TBB links. If you’re confused about which link you should be using just reach out to Siteminder again and they’ll be able to let me know what it should be.

If you failed to contact Siteminder in the original step then your old URL might still exist and won’t have been updated yet. You absolutely must contact Siteminder before you begin this tutorial to ensure that you have the new URL and that your Google Analytics code is setup within TBB.


  • For APAC: [https://]
  • For EMEA: [https://]


  • For APAC: [https://]
  • For EMEA : [https://]

Replace [https://] with https://

Need help? Get help with your setup.

If all of this seems too technical for you, or you’re worried about setting it up incorrectly, the best thing you can do is seek help from a professional. PixelRush specialises in high converting hotel websites and setting up The Booking Button with Google Analytics is something we’re very experienced in.

Get in touch with us today for a quote on setting this up for your hotel today. We can also assist with creating comprehensive reporting and dashboards to show you and your management team exactly how your site is performing and which digital channels are generating the most revenue for your business.

Don’t throw away money to the OTAs, build a website that performs.

2 comments on “Integrating Google Analytics With Booking Button For Hotel Websites

  1. Ana Luisa Lu on

    Hi Byron,

    Thank you for this tutorial. We however, do not have access to the client’s website and would like to implement this through Google Tag Manager.

    Can you advise how we can do GTM implementation of Steps 1 and 2 above?

    Thank you,
    Ana Luisa Lu

    • Byron Trzeciak on

      Hi Ana,

      Sorry for late response. In Google Tag Manager you have the option to implement the Google Analytics Tag using Google Tag Manager or you could also just copy the scripts from 1 and 2 above and embed them as a custom script. That should still work in the same way.

      Hope that helps


Leave a Reply

Your email address will not be published. Required fields are marked *

Google Rating
Based on 57 reviews

Speak To A Marketer, Not A Salesperson.

Schedule a call to talk about your business. No commitment, no sales pitch, just a conversation.

Enter Your Details

We'll only send you awesome stuff!

Let's Chat

Contact us today for a no obligation chat - no sleazy sales guys, just an honest chat about how we can help you. We will provide you with our case studies, our process and most importantly the strategy will use to get your business results.

We'll call you for more information