Integrating GA with The Booking Button

Integrating GA with The Booking Button

Using The Booking Button? Lens10 recently helped SiteMinder to update their Google Analytics integration to Universal. Follow this guide to attribute hotel bookings to the original campaign or traffic source in Google Analytics.

Implementation Guide:
Siteminder The Booking Button Integration for Universal Google Analytics

This guide assumes you already have Google Analytics set up on your site. If you are new to Google Analytics you can find out more online, or contact us to find out more about our support services.

Request SiteMinder to Update Your Account

To enable the advanced tracking in Google Analytics you must first request SiteMinder to update your account.
Email to ask that source attribution be set up for your hotel. SiteMinder with the following information:
(i) Your Google Analytics Account ID (e.g. UA-123456-1) and the type of tracking code you are using on your site (e.g. Classic or Universal).
(ii) A list of hotel names and their The Booking Button property ID’s (e.g. AAAAAAAA) associated with the view.
(iii) A The Booking Button client prefix: Usually the name of your business in lower case with dashes replacing any spaces, e.g. Melbourne Hotels would be melbourne-hotels. Note that this is used as a reference only and is not used by guests.

Technical Implementation

Once SiteMinder confirms that your account has been updated then you need to follow these steps in your Google Analytics and on your website.

Step 1: Update your Google Analytics Tagging

If you are using the latest asynchronous Universal Analytics tracking code it will be similar to the snippet below.
Example: Existing Snippet

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
ga('create', 'UA-4951048-1', 'auto');
ga('send', 'pageview');

If your tracking code is not similar to the above snippet, you may still be using the traditional (ga.js) tracking code or Google’s Classic tracking code and it is highly recommended you take this opportunity to migrate to the latest version of Google Universal Analytics tracking.

Updated Code Snippet

Replace the following fields in the script snippet with the information you supplied to SiteMinder:
a. <Your GA Account ID> (e.g. UA-1234567-8)
b. <Your client prefix> (e.g. melbourne-hotels)

<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 =  'UA-1234567-8'
var tbb_cid = 'melbourne-hotels'
var tbb_domain = '';
ga('create', tbb_ga, {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', [tbb_domain]);
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');

The tag should be placed just after the opening <body> tag on your pages.
Note that if your existing Google Analytics tracking code has been customised, then you may need to further customise this example code snippet. If you already use the jQuery JavaScript library on your site (search page source for “jquery”) then the first line of the above code can be removed.

Step 2: Enabled Ecommerce Tracking in Google Analytics

You must have ecommerce tracking switched on in Google Analytics to view transaction data including revenue.

Step 3: Create a Filter to remove virtual page views.

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

Step 4: 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.
For Universal Analytics accounts only, ensure you have the domain name of TBB set in the referral exclusion list for your Google Analytics property as shown below.

Step 5: Update TBB links on your website

Although the tag will automatically add the client prefix to hyperlinks to TBB pages it is best practice to manually update e.g.
It is highly recommended that you then test that your links to TBB are still working correctly after updating.

Step 6: Look for your new data

After a day or two, check your Google Analytics traffic sources report:
Standard Reporting> Traffic Sources> All Sources
Select the ecommerce metrics tab and look for ecommerce revenue being attributed across a range of traffic sources rather than to

Further Support?

Lens10 is a Google Analytics Certified Partner. We offer a range of support packages to assist you in setting up, customising and driving insights from Google Analytics with your hotel site. Contact us for more information.


Stay in touch with industry trends and updates

by subscribing to our newsletter


Find out more about how we can help with your Digital Analytics

Contact us