Setup Google Analytics Ecommerce tracking

Created by Katrín Magnúsdóttir, Modified on Wed, 27 Sep, 2023 at 1:01 PM by Katrín Magnúsdóttir

In order to track ecommerce data from Booking Factory's Internet Booking Engine (IBE) you need to follow these steps.


Go into Settings -> Connectivity Settings -> Booking Engine Settings. There you need to select the appropriate Booking Engine Profile and click the pencil (edit) icon. (click on image to enlarge)


Once you have your the edit form open you need to navigate down to Google Analytics code and copy the following code in the field:


<!-- Begin Google Analytics code -->
<script async src=""></script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'GA_MEASUREMENT_ID');

function confirmation_tag(booking_object) {
if (booking_object['booked_rooms'] && booking_object['booked_rooms'].length > 0) {
items = [];
var pagePath = location.href;
var pageTitle = 'Confirmation Page - Booking';

booking_object['booked_rooms'].forEach((booked_room) => {
quantity: booked_room.count,
price: booked_room.full_price
booking_object['booked_extras'].forEach((booked_extra) => {
id: booked_extra.title,
name: booked_extra.title,
quantity: booked_extra.count,
price: booked_extra.price
gtag('event', 'purchase', {
"transaction_id": booking_object['token'],
"affiliation": "Booking Factory",
"value": booking_object['amount'],
"currency": booking_object['currency'],
"items": items,
"page_path": pagePath,
"page_title": pageTitle
<!-- End Google Analytics code -->


You need to replace the GA_MEASUREMENT_ID in the code with the appropriate values you receive from your Google Analytics account.


Once that is finished you just need to click save on the Booking Profile edit form and you're all set. Your IBE will now track all of the ecommerce data from completed bookings.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article