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:
- Head to Admin in Google Analytics
- Under the Property Column select Property Settings
- 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 https://app-apac.thebookingbutton.com/properties/diplomatmoteldirect
- 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.
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '<INSERT TRACKING ID>', 'auto');
ga('send', 'pageview');
</script>
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="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
var tbb_ga = '<Your GA Account ID>';
var tbb_cid = '<Your client prefix>';
var tbb_domain = 'app-apac.thebookingbutton.com';
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];
b.appendChild(e);
}
});
// Automatically apply TBB prefix to thebookingbutton links
$(document).ready(function(){
$('a[href*="'+tbb_domain+'"]').each(function(){
this.href = this.href.replace(new RegExp(tbb_domain+'/properties', 'i'), tbb_domain+'/'+tbb_cid+'/properties');
});
});
</script>
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.
- Go to Admin in Google Analytics
- Go to the view column and select eCommerce settings
- Switch eCommerce from OFF to ON.
- Press next step
- 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.
- Go to Admin Google Analytics
- Find the view column and then select filters
- Call the filter “Remove cookie sync virtual pageview”
- Select filter type of custom
- Select Request URI as the Filter Field
- 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.
- Select Admin in Google Analytics
- Go to the Property Column
- Select Property Settings
- 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.
- Select Admin in Google Analytics
- Property column -> Js Tracking Info
- Referral exclusion list
- Add www.thebookingbutton.com.au as an exclusion
- 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.
OLD
- For APAC: [https://]app-apac.thebookingbutton.com/properties/tbbdemodirect
- For EMEA: [https://]app.thebookingbutton.com/properties/tbbdemodirect
NEW
- For APAC: [https://]app-apac.thebookingbutton.com/demo-hotel/properties/tbbdemodirect
- For EMEA : [https://]app.thebookingbutton.com/demo-hotel/properties/tbbdemodirect
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.
One Response
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