Booking Flow


We will use the following GA4 events:


Events

Key

GA4 event

Description

Product Impression (Destination)

PID

view_item_list

Impressions in search results by destination

Product Impression (Hotel)

PIH

view_item_list

Impressions in search results by hotel

Product Click

CL

select_item

Click on product impression (hotel / room)

Product Detail

PD

view_item

Impressions in search result by hotel

Add to Cart

AC

add_to_cart

Select room and add to cart

Checkout

CO

begin_checkout

Check out page

Purchase

PU

purchase

Purchase




Variables


We configure the GA4 event variables in this way:


Variable

Description

Example

PID

PIH

PD

AC

CO

PU

item_id

Hotel's ID

12345

x

x

x

x

x

x

item_name

Hotel

Hotel Demo Hotetec

x

x

x

x

x

x

affiliation

Source page

HPH

x

x

x

x

x

x

coupon

Promotional code

BlackFriday2020

x

x

x

x

x

x

currency

Currency

EUR

x

x

x

x

x

x

discount

Discount applied

2.22

x

x

x

x

x

x

index

Search position

0

x

x

x

x

x

x

item_brand

Type of accommodation (Hotel, Apartments)

Hotel

x

x

x

x

x

x

item_category

Hotels's country

ES

x

x

x

x

x

x

item_category2

Hotel's destination

Mallorca

x

x

x

x

x

x

item_category3

Hotel's zone

Can Pastilla

x

x

x

x

x

x

item_list_id

Search type ID

dest_ok

x

x

x

x

x

x

item_list_name

Search type

Destination OK

x

x

x

x

x

x

item_variant

Room/Package

Doble Estandard

 

x

x

x

x

x

price

Total room rate

100

x

x

x

x

x

x

quantity

Number of rooms

1

x

x

x

x

x

x

regimen

Meal plan

TI, SO, AD

 

x

x

x

x

x

tarifa

Rate

Non Refundable

 

x

x

x

x

x

check_in

Check-in

20-12-2022

x

x

x

x

x

x

check_out

Check-out

25-12-2022

x

x

x

x

x

x

booking_window

Booking window

65

x

x

x

x

x

x

noches

Nights reservation

5

x

x

x

x

x

x

pax

Occupancy type: Adults-Children-Babies

2–0-0

x

x

x

x

x

x



Specifically for the "impression" events we will work with four variables of item_list_name:


item_list_name

item_list_id

Value

Hotel OK

hotel_ok

Search by hotel with availability

Hotel KO

hotel_ko

Search by hotel without availability

Destination OK

destination_ok

Search by destination with availability

Destination KO

destination_ko

Search by destination without availability


IMPORTANT: "Hotel KO" and "Destiantion KO" are not implemented because the booking engine does not return searches without results but it will always offer alternatives.


Implementation


1. Product impressions (destination) - view_item_list

https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtm#select_an_item_from_a_list


Description: We register each search at destination level with view_item_list (impression) event that includes an array with hotels.


Page: Searches by destination


Trigger: We launch dataLayer push when returning search results.


Event Name: view_item_list


dataLayer.push({ ecommerce: null });  // Clear the previous ecommerce object.
dataLayer.push({
  
event"view_item_list",
  
ecommerce: {
    
items: [
    {
//Primer hotel
    
item_id"12345",
    
item_name"Hotetec Demo Hotel",
    
affiliation"HPH",
    
coupon"BLACKFRIDAY",
    
currency"EUR",
    
discount10.00,
    
index0,
    
item_brand"Hotel",
    
item_category"ES",
    
item_category2"Mallorca",
    
item_category3"Can Pastila",
    
item_list_id"dest_ok",
    
item_list_name"Destination OK",
    
price99.99,
    
check_in"2022-12-01",
    
check_out"2022-12-05" ,
    
booking_window65,
    
noches5,
    
pax2-0-0,

      quantity1
    },
    {
    
//Todos los hoteles
    }]
}
});


2. Product impressions (hotel & packages) - view_item_list

https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtm#select_an_item_from_a_list


Description: We log each visit at hotel level with view_item event.


Page: A visit to availability's page at hotel level.


Trigger: We launch dataLayer push when hotel rooms page is loaded


Event Name: view_item


dataLayer.push({ ecommerce: null });  // Clear the previous ecommerce object.
dataLayer.push({
  
event"view_item_list",
  
ecommerce: {
    
items: [
    {
//Primera habitación o paquete
    
item_id"12345",
    
item_name"Hotetec Demo Hotel",
    
affiliation"HPH",
    
coupon"BLACKFRIDAY",
    
currency"EUR",
    
discount10.00,
    
index2,
    
item_brand"Hotel",
    
item_category"ES",
    
item_category2"Mallorca",
    
item_category3"Can Pastila",
    
item_list_id"hotel_ok",
    
item_list_name"Hotel OK",
    
item_variant"Doble Estandard",
    
price99.99,

      check_in"2022-12-01" ,
    
check_out"2022-12-05" ,

      regimen"AI",

      tarifa"No reembosable",
    
booking_window65,
    
noches5,
    
pax2-0-0,

      quantity1

    },
    {
    
//Todas las habitaciones
    }]
}
});


3. Room's click - select_item

https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtm#select_an_item_from_a_list


Description: We register each click made on results that includes information about the selected object.


Page: Destination/hotel search results


Trigger: We launch a dataLayer push when a click is made in a hotel


Event Name: select_item


Room's example:

dataLayer.push({ ecommerce: null });  // Clear the previous ecommerce object.
dataLayer.push({
  
event"select_item",
  
ecommerce: {
    
items: [
    {
// La habitación que ha recibido el click
    
item_id"12345",
    
item_name"Hotetec Demo Hotel",
    
affiliation"HPH",
    
coupon"BLACKFRIDAY",
    
currency"EUR",
    
discount10.00,
    
index2,
    
item_brand"Hotel",
    
item_category"ES",
    
item_category2"Mallorca",
    
item_category3"Can Pastila",
    
item_list_id"hotel_ok",
    
item_list_name"Hotel OK",
    
item_variant"Doble Estandard",
    
price99.99,
    
check_in"2022-12-01" ,
    
check_out"2022-12-05" ,
    
regimen"AI",
    
tarifa"No reembosable",
    
booking_window65,
    
noches5,
    
pax2-0-0,

      quantity1
    }]
}
});

4. Add/remove to cart

https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtm#add_or_remove_an_item_from_a_shopping_cart


Description: We register the selection of a room with an add to cart event - add_to_cart


Page: Search → Checkout 


Trigger: We launch a dataLayer push on room selection (buton BOOK).  In case of multi-rooms the dataLayer push is triggered for each added room.


Event Name: add_to_cart


dataLayer.push({ ecommerce: null });  // Clear the previous ecommerce object.
dataLayer.push({
  
event"add_to_cart",
  
ecommerce: {
    
items: [
{
    
item_id"12345",
    
item_name"Hotetec Demo Hotel",
    
affiliation"HPH",
    
coupon"BLACKFRIDAY",
    
currency"EUR",
    
discount10.00,
    
index2,
    
item_brand"Hotel",
    
item_category"ES",
    
item_category2"Mallorca",
    
item_category3"Can Pastila",
    
item_list_id"hotel_ok",
    
item_list_name"Hotel OK",
    
item_variant"Doble Estandard",
    
price99.99,
    
check_in"2022-12-01" ,
    
check_out"2022-12-05" ,
    
regimen"AI",
    
tarifa"No reembosable",
    
booking_window65,
    
noches5,
    
pax2-0-0,

      quantity1
}]
}
});


5. Checkout


5.1 begin_checkout

https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtm#initiate_the_checkout_process


Description: We register when a client goes to the customer form with a checkout event.


Page: Client form (on page load)


Trigger: When the checkout page is loaded.


Event Name: begin_checkout


dataLayer.push({ ecommerce: null });  // Clear the previous ecommerce object.
dataLayer.push({
  
event"begin_checkout",
  
ecommerce: {

    currency"EUR",
    
value89.99,
    
coupon"BLACKFRIDAY",
    
items: [
{
    
item_id"12345",
    
item_name"Hotetec Demo Hotel",
    
affiliation"HPH",
    
coupon"BLACKFRIDAY",
    
currency"EUR",
    
discount10.00,
    
index2,
    
item_brand"Hotel",
    
item_category"ES",
    
item_category2"Mallorca",
    
item_category3"Can Pastila",
    
item_list_id"hotel_ok",
    
item_list_name"Hotel OK",
    
item_variant"Doble Estandard",
    
price99.99,
    
check_in"2022-12-01" ,
    
check_out"2022-12-05" ,
    
regimen"AI",
    
tarifa"No reembosable",
    
booking_window65,
    
noches5,
    
pax2-0-0,

      quantity1
    },{

    //todas las habitaciones

    }]
}
});


5.2 add_shipping_info


https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtm#add_shipping_info-gtm


Trigger: When the customer data fields are fulfilled

Event Name: add_shipping_info


dataLayer.push({ ecommerce: null });  // Clear the previous ecommerce object.
dataLayer.push({
  
event"add_shipping_info",
  
ecommerce: {
    
currency"EUR",
    
value89.99,
    
coupon"BLACKFRIDAY",
    
items: [
{
      
item_id"12345",
    
item_name"Hotetec Demo Hotel",
    
affiliation"HPH",
    
coupon"BLACKFRIDAY",
    
currency"EUR",
    
discount10.00,
    
index2,
    
item_brand"Hotel",
    
item_category"ES",
    
item_category2"Mallorca",
    
item_category3"Can Pastila",
    
item_list_id"hotel_ok",
    
item_list_name"Hotel OK",
    
item_variant"Doble Estandard",
    
price99.99,
    
check_in"2022-12-01" ,
    
check_out"2022-12-05" ,
    
regimen"AI",
    
tarifa"No reembosable",
    
booking_window65,
    
noches5,
    
pax2-0-0,

      quantity1    

    }]
}
});



5.3 add_payment_info


https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtm#add_payment_info-gtm


Trigger: When the card data field is filled out

Event: add_payment_info


dataLayer.push({ ecommerce: null });  // Clear the previous ecommerce object.
dataLayer.push({
  
event"add_payment_info",
  
ecommerce: {
    
currency"EUR",
    
value89.99,
    
coupon"BLACKFRIDAY",
    
payment_type"Credit Card",
    
items: [
{
      
item_id"12345",
    
item_name"Hotetec Demo Hotel",
    
affiliation"HPH",
    
coupon"BLACKFRIDAY",
    
currency"EUR",
    
discount10.00,
    
index2,
    
item_brand"Hotel",
    
item_category"ES",
    
item_category2"Mallorca",
    
item_category3"Can Pastila",
    
item_list_id"hotel_ok",
    
item_list_name"Hotel OK",
    
item_variant"Doble Estandard",
    
price99.99,
    
check_in"2022-12-01" ,
    
check_out"2022-12-05" ,
    
regimen"AI",
    
tarifa"No reembosable",
    
booking_window65,
    
noches5,
    
pax2-0-0,

      quantity1

    }]
}
});


6. Purchase

https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtm#make_a_purchase_or_issue_a_refund


Trigger: When the reservation is confirmed

Event: purchase


dataLayer.push({ ecommerce: null });  // Clear the previous ecommerce object.
dataLayer.push({
  
event"purchase",
  
ecommerce: {
      
transaction_id"MAJ12345678",
      
affiliation"HPH",
      
value89.99,
      
tax4.90,
      
currency"EUR",
      
coupon"BLACKFRIDAY",
      
items: [
{
    
item_id"12345",
    
item_name"Hotetec Demo Hotel",
    
affiliation"HPH",
    
coupon"BLACKFRIDAY",
    
currency"EUR",
    
discount10.00,
    
index2,
    
item_brand"Hotel",
    
item_category"ES",
    
item_category2"Mallorca",
    
item_category3"Can Pastila",
    
item_list_id"hotel_ok",
    
item_list_name"Hotel OK",
    
item_variant"Doble Estandard",
    
price99.99,
    
check_in"2022-12-01" ,
    
check_out"2022-12-05" ,
    
regimen"AI",
    
tarifa"No reembosable",
    
booking_window65,
    
noches5,
    
pax2-0-0,
    
quantity1
},
      { 
//Todas las habitaciones
}]
}
});