Google Tracking - GTM & GA Configuration

Google Tag Manager & Analytics Configuration

:straight-ruler: This document will help you to set up proper tracking through Google Tag Manager
& Google Analytics.

❗️

IMPORTANT - TRACKING

It’s critical that the instructions are followed in order to track bookings made through Selfbook. Proper setup will avoid any discrepancies with data reporting.

There are two key pieces in setting up proper tracking:

  1. Google Tag Manager - Events tracked by Selfbook
  2. Google Analytics Configuration

PART 1: Google Tag Manager Events Tracked by Selfbook

Selfbook SDK will automatically inherit your existing Google Tag Manager setup, and sync the following actions to your account:

  • Availability
  • Payment method selected / add credits
  • Book now

Step 1: Availability

2 events are triggered

  • checkAvailability: when the user initially checks the availability response (first result)
  • eec.detail: when the user moves to the next room.

Both events include:

  • room and rate info

dataLayer.push

window.dataLayer.push({
    event: 'checkAvailability’,
    ecommerce: {
        checkout: {
            actionField: {
                step: 1
            },
            products: [{
                id: 'room_id',
                name: 'Room name',
                variant: 'rate id',
                category: 'guides/google-tag-manager/enhanced-ecommerce',
                brand: 'property name',
                quantity: 1,
                price: 'rate nightly average',
                dimension3: 'Ecommerce',
            }]
        }
    }
});
{
    event: 'eec.detail',
    ecommerce: {
        detail: {
            products: [{
                id: 'room id',
                name: 'room name',
                category: 'guides/google-tag-manager/enhanced-ecommerce',
                variant: 'rate id',
                brand: 'property id',
                quantity: 1,
                price: 'room price',
                dimension3: 'Ecommerce'
            }]
        }
    }

Step 2: Payment method selected/add credits
-paymentMethodSelected is triggered when the user selected a payment method

window.dataLayer.push({
    event: 'paymentMethodSelected',
    ecommerce: {
        checkout: {
            actionField: {
                step: 2
            },
        }
    }
});

Step 3: Book now
-roomPurchase event is triggered when the user makes a reservation. it includes:

  • room and rate info
  • price and taxes
  • add ons info
window.dataLayer.push({
    event: 'roomPurchase',
    ecommerce: {
        currencyCode: 'EUR',
        purchase: {
            actionField: {
                id: 'reservation id',
                revenue: 'totalAfterTax',
                tax: 'totalTaxes',
                coupon: 'promocode
            },
            products: [{
                id: 'room_id',
                name: 'room name',
                category: 'guides/google-tag-manager/enhanced-ecommerce',
                variant: 'rate id',
                brand: 'property name',
                quantity: 1,
                price: 'rate nightly average',
                dimension3: 'Ecommerce',

            }, {
                id: 'service_id',
                name: 'service name',
                price: 'service aount',
                quantity: 1,
            }]
        }
    }
});

PART 2 - Google Analytics Configuration

In order to track the events in GA, you need to configure the tag manager in the following way:

  1. Create a trigger with an event name equal to the same event name that’s fired from Selfbook.
  1. Create a tag with the following options:
    Track type: Event
    Category: Selfbook event name
    Action: Any action label
    Enable overriding settings in this tag
    Enable enhanced e-commerce features
    Enable use data layer
  1. Track the events through GA