Tracking TourCMS Booking Engine using Google Analytics 4 (article)

Susana Moleón
Susana Moleón
  • Updated

For an introduction to Google Analytics 4, including details of how to migrate your account from older Universal Analytics check Google's own Version 4 documentation.

JavaScript tracking tags can be placed on the first and last pages of the booking process via Configuration > Channels. This tutorial details some of the considerations for using this with the popular Google Analytics service however the techniques should be applicable to other similar solutions.

A note on Marketplace Bookings

Where an OTA is using their own TourCMS booking engine links on their own website your JavaScript code will not be used, thus any bookings made via this method will not show in your Google Analytics.

 

Basic tracking

Basic tracking will allow you to see visits to each step of the TourCMS booking process in your Google Analytics data.

  1. Add your Google Analytics tracking code to each step of the TourCMS booking engine (Configuration > Channels > Tracking & Analytics)
  2. Enable cross domain tracking on your Google Analytics 4 property. You can do this via the Google Analytis Admin page, for details see Google cross domain tracking documentation, the domain you will need to allow cross domain tracking for is live.tourcms.com.

 

Ecommerce tracking

Ecommerce tracking allows you to track customer purchases in Google Analytics. For some background, view Google's own documentation on ecommerce tracking with GA4.

TourCMS documentation tokens can be used to fill in the details of what the customer has booked, the tokens will be replaced by TourCMS before your tracking tags are displayed. For example adding the following to Step 5 - Thank you page:

 

<script>
gtag("event", "purchase", {
    transaction_id: "%b_id%",
    value: %b_base_sale_price_total_inctax_exlp%,
    currency: "%b_sale_currency%",
    coupon: "%promo_code%",
    items: [
     {
      item_id: "%t_id%",
      item_name: "%t_name_web%",
      index: 0,
      price: %t_price%,
      quantity: %tour_quantity%
    }]
});
</script>

 

If you load TourCMS booking engine in an Iframe

At the time of writing cross domain iframe tracking using Google Analytics 4 is somewhat tricky, this is due to browsers increasingly blocking third party cookies.

You may wish to check this guide on third party Iframe tracking by Simho Ahava which goes into detail about the limitations of Google Analytics V4, and offers a solution avoiding the user of cookies and instead the tracking within the iframe (TourCMS) can be configured to push all dataLayer events to the parent (your website) without the use of cookies which are increasingly blocked on third party sites. Jump to the suggested solution.