By Scott Thomas
If you’ve experimented with Google Analytics, you probably know you can set up and track Goals with it, but two things can make it challenging – (1) how to track goals from your site through the booking process, which usually takes place on a website managed by your booking software company, and (2) how to set up your goals so they are useful. Just to add to the confusion, Google has recently updated Analytics, changing the way you track from your site to the booking engine.
In this post, we’ll look at the way to install the Google Analytics (GA) code, and how to set up your goals to track your bookings.
Overview of Tracking from Your Site to the Booking Engine
If you don’t care how it works, you can just skip to the next section to begin putting it together.
Google has changed the way you track visitors who go from your website to your booking engine. When you have GA tracking code on your site, it creates a cookie to track a visitor, storing bits of information, like the way they arrived at your site, the time they arrived, and the path they take through your site. Normally these cookies do not allow other sites to read them. As a result, when the visitor goes to your booking engine, the tracking code sees it as another site, and the booking engine cannot read the cookie from your site. This means your Analytics will not show the source of the booking as being from the true referring source, but will show it as coming from your site.
In order to track the visitor through your site, to the booking system (and potentially back to your site again), you must set up the tracking code to allow the booking engine to be considered as if it was part of your site, and read the cookie even though it is technically another site.
Setting Up Tracking to Include Your Booking Engine
Previously Google had recommended using a line of code to tell GA to consider the two sites (yours and the booking engine) to both have access to the tracking cookie by setting the domain to “none”. GA has changed this, so that setting the domain name to “none” will now prevent a sub-domain (if the primary domain is www.abouttheinn.com, an example of a subdomain would be blog.abouttheinn.com) from accessing the cookie from the primary domain, unless you explicitly permit it. Consequently, you’ll want to use the newer approach.
1. Modify the GA code for your website
Basic GA tracking code for your website will look something like this (with the XXXXX-X section changed to reflect your GA ID):
`
Don’t worry about the details, but if you’re interested a full explanation is in the GA Help documents.
In order to track the cookie from your site over to the booking engine site, you’ll want to modify a portion of your tracking code on your website to look like:
var _gaq = _gaq || [];<br /> _gaq.push(['_setAccount', 'UA-XXXXX-X']);<br /> _gaq.push(['_setDomainName', 'YOURWEBSITE.com']);<br /> _gaq.push(['_setAllowLinker', true]);<br />
Then wherever you link to your booking engine, it needs the link code:
<a href="https://www.BOOKINGENGINE.com/AVAILABILITY.html"<br /> onclick="_gaq.push(['_link', 'https://www.BOOKINGENGINE.com/AVAILABILITY.html']); return false;">Book Now</a>
There are basically two things you are changing. First, after the setAccount line, you add a line (setDomainName) to specify the domain name as your site, then add another line (setAllowLinker) to permit linking to another site. Second, wherever you link to the other site, you add the “onclick” JavaScript to pass the cookie to the site named (BOOKINGENGINE.com).
The first part gives permission to pass the cookie with a link. The second actually does it.
2. Modify the code on your booking engine
Some booking engines (notably the RezOvation GT booking engine, ResNexus, and probably others) will have made the changes for you, or will make them if you so request. Others, like Webervations, will provide a text field in a setup form where you can paste in your code. However it is done, the resulting code on the booking engines should look like this:
var _gaq = _gaq || [];<br /> _gaq.push(['_setAccount', 'UA-XXXXX-X']);<br /> _gaq.push(['_setDomainName', 'none']);<br /> _gaq.push(['_setAllowLinker', true]);
Actually, the key sections are setAccount, which must be set to your domain’s GA ID, and setAllowLinker, when set to “true” will allow you to track clicks back to your site. This code will allow the booking engine to use your tracking cookie for your transactions, but not for transactions by another lodging property. If your booking engine page has a link back to your site, the link should include the linker code:
<a href="www.YOURWEBSITE.com"<br /> onclick="_gaq.push(['_link', 'www.YOURWEBSITE.com']); return false;">Return to Our Site</a>
Now that the website and booking engine tracking code is set up properly, we need to set up our goals.
Setting Up Your Completed Booking as a Goal
In your GA account (we’re using the “new” GA here, Google Analytics 5), click the little “gear” icon in the upper right, then click on the Goals tab. Next,
Once you have data from your goals, you’ll be able to see the referral sources that have sent them, and other data that may be helpful to you.