Knowledgebase: MSO
Google Analytics Conversions - Ecommerce Overview
Posted by Jason Timms on 26 Sep 2012 07:37 AM

Google Analytics Conversions - Ecommerce Overview



BookingCenter offers the option to track Google Analytics's (GA) Goals and Conversions via the Booking Engine. In order to use these services, you need to have a Google Analytics Account setup. And you need to have a Webmaster or marketing person who understands how GA needs to be setup for Goals and Conversions. This is important, because BookingCenter's MSO feature is NOT a service to setup, interpret, nor manage your GA account - we simply offer technology that allows the GA architecture to be used with our Booking Engine.

More can be learned at: www.google.com/analytics/ for setting up and working with Google Analytics's (GA) Goals and Conversions. Please know that if you are going to use the Booking Engine inside an iFrame, then read below for issues with Google Analytics and iFrames.

 

  • More can be learned at: http://www.bookingcenter.com/interfaces-and-modules/marketing-services-mso/ for general learning.
  • For specifics for setting up BookingCenter to work with Google Analytics and the Google Tag Manager to make the ecommerce tracking work well, view this documentation.  A PDF we wrote on how to test your GA implenentation is here.  
  • Because some customers had insecure code in their 'tracking code', we have placed this section of the Booking Engine behind a CSP (Content Security Policy) so we will review your 'tracking code' to make sure that it can't be used to manipulate a client of yours in a phishing, cross site, or injection attempt.  Read about the CSP and how to send us your final, tested tracking code from your webmaster.

 

The broad outline for working the Goals and Conversions via the Booking Engine is as follows:

Step #1 – Setting up your Google Analytics in BookingCenter
Step #2 – Generate a Booking via your website.
Step #3 – Tracking your Bookings through Google Analytics Reporting


Step #1 – Setting up your Google Analytics in BookingCenter
--------------------
Setting up the Google Analytics with the Desktop PMS view here: https://support.bookingcenter.com/index.php?/Knowledgebase/Article/View/339

*note, if you have questions about how GA3 differs from GA4 in support of our tracking, read the documentation here.


Setting up the Google Analytics with the MyPMS or Channel Manager view: http://www.bookingcenter.com/interfaces-and-modules/marketing-services-mso/  where we give detailed directions for placing the Google Analytics code.

Note, the Google Analytics Code needs to be retrieved from your Google Analytics account and placed into the MSO area.  We have a sample screen shot here for what this looks like.


Step #2 – Generate a Booking via your website.
--------------------

On your website, generate an online booking after placing the codes as described above.

We have a Test GA account you can view how it's working for our test Account at: http://jt.bookingcenter.com/timbitlodge/ Click on Book Now! and make a booking to test this (nothing will be charged to you, this is just a test account).

If you are having trouble getting your GA to update based on the Goals and Conversions you set, our advice is to make your own test pages, post the GA code to your Test Account using hard-coded values in place of our dynamic values. Make sure the only difference in the code between your Test pages and the Booking Engine are the two variables our Booking Engine dynamically posts:

  • Booking Number: %%$booking_id%%
  • Total Price: %%$total_price%%

These variables below were supported in Universal Analytics but are not supported in all implementations of GA4 via their Tag Manager - they do work via our CSP and if well-executed in Tage Manager these values canalso be collected and saved within your Google Analytics goals & conversions accojnt.

  • Arrival Date: %%$arrival_date%%
  • Departure Date: %%$departure_date%%
  • Agent: %%$agent_id%%
  • Currency: %%$currency_id%%
  • Total Number of Adults: %%$total_adults%%
  • Total Number of Children: %%$total_children%%
  • Total Room Count: %%$total_room_count_id%%
  • Total number of nights: %%$total_nights%%


Make a booking and have it register on GA (remember, it takes ~ 24 hrs to register). Then once you know it registers, do it with the Booking Engine (dynamically, where we post the booking_id and total_price ) and view the results in GA. You can test the two case studies by choosing your browser's 'show source' and code check the results - GA ought to be identical between your Test pages and results from the Booking Engine that post dynamically from the booking ID and cost of the booking.


Note: Tracking from your Google Analytics account can take up to 24 hrs. What this means is that a booking you make NOW may not show in your Google Analytics account for up to 24 hrs - sometimes a little faster.


Step #3 – Tracking your Bookings through Google Analytics Reporting
--------------------
Learning how to setup the Goals and Conversions in GA is not trivial, though there are thousands of webmasters globally who know how to do it. A simple Google search can introduce you to one of these.

For a sample of information reported back from our Test account, as booked above, please see the attached document to this KnowledgeBase article.



Using iFrames and Google Analytics?
--------------------
Google provides a javascript line that enables you to "allow" google to have its cookie file follow the person through an iframe to capture eCommerce data. It will NOT, however, provide that code easily, or when you copy and paste it from the analytics site. We believe its because its script, by default, doesn't wish to scrape up tons of iframe data unless explicity told to do so, freeing up its servers. This is only our assumption as to why Google makes this difficult for iFrame implementations.

So after communicating and delving pretty deep in the dev community, we found a snippet of javascript:

_gaq.push(function() {
var pageTracker = _gat._getTrackerByName();
var iframe = document.getElementById('IFRAMEID');
iframe.src = pageTracker._getLinkerUrl('IFRAMESOURCE');
});

When placing the code into the google generated analytics code like so:

where blockrandom was the Iframe ID and the iframe.src was re-directed appropriately to BookingCenter.


<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'XXXXX']);
_gaq.push(['_setDomainName', 'yourdomain.com']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
_gaq.push(function() {
var pageTracker = _gat._getTrackerByName();
var iframe = document.getElementById('blockrandom');
iframe.src = pageTracker._getLinkerUrl('http://requests.bookingcenter.com/enquiry.phtml?site=SitedID&#039;);
});
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl&#039; : 'http://www&#039;) + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>


Often times there is some code to edit that generates google analytics code for a specific CMS theme - weve witnessed this using joomla, wordpress, and Ruby. When removed, and only using google-generating, hard-coded code in the javascript of the theme header of the CMS, we had success.  Getting this clear is vital to make sure clients with Iframes use this approach and method. All-in-all, its just telling googles javascript where to look, and where to go.


-----------------------

BookingCenter requires that an MSO 'Premium Marketing Services' contract is in place in order for this to work. Go to: http://www.BookingCenter.com/contact/ to request the service or call us at +1-707-874-3922 ext 201.

Learn more about the MSO 'Premium Marketing Services' contract at: http://www.bookingcenter.com/interfaces-and-modules/marketing-services-mso/

 



Attachments 
 
 1348679574466_google_analytics_conversion.pdf (301.84 KB)
(7 vote(s))
Helpful
Not helpful