Google Analytics – eCommerce tracking for Hotel Websites

 In Uncategorized

Is your TripAdvisor business listing worth the cost? Should you continue spending on Google Adwords? What’s the most popular room type booked on your website and how has revenue been this month versus last? Is my Length of Stay decreasing from higher ADRs? All these questions and so many more are easily answered in Google Analytics once you have eCommerce tracking turned on. This data is important to owners and GMs when justifying marketing spend and evaluating how your web direct channel is working.

There are two major issues that seem to arise when using Google Analytics – eCommerce tracking and cross domain tracking. The former, eCommerce tracking, is what we’ll be discussing here today, it is the ability to show real booking data in your Google Analytics account including key performance indicators ADR (Average Daily Rate), LOS (Length of Stay), and total booking value. Cross domain tracking is a common issue and tends to skew non-booking data like sessions, however, it does throw off one important metric: conversion rate (visitors to bookers). We’ll discuss that later though.

Google Universal Analytics

Google Analytics can be implemented a variety of ways, the most common are through the “Classic” script, “Universal”, and the Google Tag Manager. The classic script is still in use by some older booking engines that haven’t migrated their clients to Google Universal Analytics. If you can, and you haven’t done so, I highly recommend updating your hotel’s analytics tracking to Google Universal analytics. Google Tag Manager is a way of consolidating your website tracking scripts through one application, very useful but not always easy to implement. For the sake of education I’ll be explaining implementing Google Universal Analytics, these methods can be applied to classic or Google’s tag manager.

Are you using Google Universal Analytics? Find out here: https://support.google.com/analytics/answer/4457764?hl=en

After determining that you have Universal analytics in place, you will want to make sure that Google eCommerce tracking is turned on.

Enable Google Analytics eCommerce for your Hotel Website

You need to enable Ecommerce reporting in the view in which you want to see the data.

  1. Sign in to your Google Analytics account.
  2. Navigate to the desired account, property and view.
  3. In the VIEW column, select Ecommerce Settings.
  4. Click the Enable Ecommerce toggle ON.
  5. Optional: Click the Enable Related Products toggle ON.
  6. Click Next step.
  7. Click Submit.

Adding the Tracking Code to your Booking Confirmation Page

Once this is done you will want to add the Google Analytics code to the confirmation page of your booking engine. Below, I’ve placed a sample script. This can be copied and pasted directly into your booking engine page (place in the HTML header). Simply replace, or have your booking engine provider replace the variables in red with that of the booking engines. I’ve also left comments in bold, you can leave these in place without affecting the code.


<!—- Confirmation Page —>
<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', 'UA-1234567-1', 'auto', {'allowLinker': true}); //Replace with your Google Analytics ID
    ga('send', 'pageview', '/book/confirmation'); 

    ga('require', 'ecommerce'); 

	ga('ecommerce:addTransaction', { 
	'id': '546473035949', // Add the Transaction ID Booking Confirmation Number Here
	'affiliation': ‘ACME Hotel’, // Put the Hotel's Name here 
	'revenue': '98.10', // Input the Grand Total of booking - before tax 
	'shipping': '' , // Shipping cost - leave blank 
	'tax': '13.69' }); // Add the total tax for the booking 

	ga('ecommerce:addItem', { 
	'id': '10426', // Transaction ID or Booking Confirmation Number 
	'sku': '122201', // If you assign an ID for Room Types you can add here
	'name': ‘Studio, Standard’, // Input the Room Category Booked 
	'category': 'Best Available Rate', // Input Rate Type Booked 
	'price': '98.1', // Average Daily Rate of Booking - before tax 
	'quantity': '1'}); // Number of Nights Booked

	ga('ecommerce:send'); 

</script>

 

Hopefully this helps get you on your way to effective eCommerce tracking in Google Analytics.

Have any questions, comments, suggestions? Please leave them below.

Recent Posts
Showing 3 comments
  • sam
    Reply

    Seriously, thank you!

  • Celine
    Reply

    Hello,
    We are trying to do that but both our website developper and booking engine provider are a bit lost !
    the variable in red is changing for every booking made. So which script should he add in order to track the booking and the revenue generated?

    • Patrick Ahler
      Reply

      Hi Celine, which specific variable are you referring to?

Leave a Comment