Cross-domain Google Analytics Conversion Goals - The Best Thing Ever
Here at Fastrack Group we work with a lot of clients in the travel and accommodation niche who use external booking systems, which means that if we were only able to implement Google Analytics tracking on their own websites we'd only be seeing half the picture of visitor activity along the conversion funnel for making a booking.
Traditionally that would mean setting up a conversion goal that shows when people click on the "Book Now" button that takes visitors from the main website over to the booking system and just hoping for the best from there. Not a great solution.
But, with a bit of effort (and some cleverness in the way we set up the Google Analytics codes) we can actually track users right the way through the conversion path all the way up to the moment when they reach the booking system's confirmation page. In other words, we can see the exact moment when someone pays to complete their booking and then backtrack that booking to figure out how they found the website in the first place, whether they came from Google's organic search results (SEO), the paid search adverts (SEM) or through links from other websites (Social and more).
The specific things that need to be changed in the code will vary slightly from site to site and depending on which particular booking system is used, so I'm going to keep this part fairly general. It will cover the essential principles of setting up cross-domain tracking and goals in Google Analytics but it would take an entire book to be able to go into the details of doing it for all the different websites and booking systems that are out there.
Let's start with a bit of background about the site we'll be using for this example.
The "Shining Example Hotel" has a website at www.examplehotel.com and the take online bookings through an external system at thebookingsite.com/examplehotel so our aim is to get Google Analytics set up so that we can track visitors who come to www.examplehotel.com then click through to thebookingsite.com/examplehotel and make a confirmed booking.
We already have the basic Google Analytics tracking in place on www.examplehotel.com (but we'll be coming back soon to make some changes to that) so our next step is to get the same Analytics account tracking visits to the Shining Example's pages on thebookingsite.com/examplehotel
(NOTE: This part will be slightly different depending upon which particular third party booking system you use but most providers like HiSite or TheBookingButton will be able to help you add your own Google Analytics ID - the number that starts with UA - to the property's pages to enable basic tracking of visitors on the booking system pages.)
Next Stop: Google Analytics Goals
Now that we've got Google Analytics showing the page views for the Shining Example's pages on thebookingsite.com we need to set up a goal that will be triggered whenever someone reaches the booking confirmation page (i.e. they've chosen the dates they want to stay, entered their details and paid for their booking).
This is another part that will be different depending on the particular booking system being used but the short version is that you'll need to set up a "Destination URL" goal that uses a Regular Expression (RegEx) match to pick up every time the confirmation page is reached (most booking sites will create a unique page address that includes session ID numbers for every booking so you'll need to use RegEx to match any page that has the basic confirmation page structure for the URL regardless of the rest of the information it contains. For example HiSite always includes /confirmation.aspx in their URLs so we create a Regular Expression that looks for that.
(TIP: If you need some extra help figuring out Google Analytics RegEx matching check out Annie Cushing's great article and the rest of her blog.)
For good measure we'll also set up a conversion funnel for this goal which will only trigger the goal when people have also been through the previous steps of visiting the Property Details and Payment Entry pages on the booking system. That way the goal will only show a conversion when people go through the whole purchase process and not count it as a goal if someone bookmarks their confirmation page and comes back later to check their details.
This will mean that our Google Analytics report now shows us a conversion goal every time someone goes through the booking system and makes a booking to stay at the Shining Example Hotel, but there's a problem...
This doesn't tell us how they arrived at www.examplehotel.com in the first place
If we leave things set up like this then Google Analytics will only show the conversion path for these bookings from the point where the visitor arrives on thebookingsite.com/examplehotel. Even if the visitor clicked on the "Book Now" button on the Shining Example's own website we'll only see the conversion path as starting with a referral from www.examehotel.com and we won't get the really useful information about how that visitor got to www.examplehotel.com to start their journey towards making their booking.
The way to get around this is to go back to the way we have Google Analytics set up on www.examplehotel.com and make a couple of changes.
Setting Up Cross-Domain Tracking In Google Analytics
First thing we need to do is check that Google Analytics is working correctly on both sites. Starting will www.examplehotel.com just check the Analytics code in the site's source code and make sure that there's a line with
Now we check for the same thing on the Booking Site's pages for the Shining Example Hotel, except that there we want to see the Google Analytics code say
(BONUS STEP: Although we don't really need to do this for setting up cross-domain tracking since we're already in the site making changes to the Google Analytics codes, now's a great time to change the standard Google Analytics code to add the version that enables you to create Remarketing Lists because that will let us do some really fun things with AdWords later on.)
What we need to do now is get Google Analytics to treat visits to both www.examplehotel.com and thebookingsite.com/examplehotel as if they were all the same website.
We do this by adding a little piece of extra code to every link on www.examplehotel.com that points to thebookingsite.com/examplehotel that tells Google Analytics to ignore the usual referral information that gets passed with the link on to act like both pages exist on the same site. For any link that goes from the Shining Example's website to its pages on the Booking Site we need to change the link's html code from
That will get Google Analytics to treat visits that go from the Shining Example Hotel's website to the Booking Site as a single session, giving you access to full source information for how the visitor first found the Shining Example before moving through to make their reservation on the Booking Site.
(NOTE: Left like this it will only apply to visitors who go from www.examplehotel.com to thebookingsite.com/examplehotel. If you're setup means that visitors also regularly go in the other direction (i.e. from thebookingsite.com to www.examplehotel.com) you'll need to add that same onclick code to any link on the Booking Site as well - although depending on which booking system you work with in real life it might not be possible to make those sort of changes at the code level to your pages on the site.)
Now that those small changes to your Analytics set up and site's code have been made you can just sit back and wait for Google Analytics to start showing the conversions that happen on the Booking Site and then track them all the way back through the conversion funnel to see how they arrived at the Shining Example Hotel's website to begin with.