Google Analytics Technical Details

General information

Please note, due to security and privacy policy, tracking is not enabled on Step 3 of the booking process. For this reason, individual steps of the checkout process cannot be tracked either.

Pageview hit

Every page sends a single pageview hit with a modified page URL and title. This provides an easy way to distinguish between MaxBooking hits and hits from the property website.

Page URL Title
Booking step /maxbooking/step<step-number> Step <step-number>
Search page /maxbooking/search Search
Standard widget /maxbooking/widget Booking Widget

Product object

Product object is used to describe units related to Ecommerce actions.

Field Value Example
id Unit ID 1234
name Unit name Large Dorm
category Unit category Accommodation/Dorms
price Price 29.00
currency Currency EUR
quantity Number of units 2

Notes:

  • Unit category uses the following format: Accommodation/<category-name>

Step 2

Ecommerce data (action + product data) in Step 2 is sent with Google Analytics events that are triggered by customer's actions.

Events based on customer's actions

Standard:

  • The customer selects a unit
    • Product view event
    • Cart addition event
  • The customer unselects a unit
    • Cart removal event
  • The customer continues to Step 3 (clicks the "next" button)
    • Checkout event

Mobile:

  • Customer opens unit detail
    • Product view event
  • The customer selects a unit
    • Cart addition event
  • The customer unselects a unit
    • Cart removal event
  • The customer continues to Step 3 (clicks the "Next" button)
    • Checkout event

Product view event

Event fields:

Field Value
eventCategory Step2
eventAction Product view
eventLabel <unit-name>

Ecommerce data:

action detail
data Product details for the unit

Cart addition event

Event fields:

Field Value
eventCategory Cart
eventAction Add to cart
eventLabel <unit-name>

Ecommerce data:

action add
data Product details for the unit

Cart removal event

Event fields:

Field Value
eventCategory Cart
eventAction Remove from cart
eventLabel <unit-name>

Ecommerce data:

action remove
data Product details for the unit

Checkout event

Event fields:

Field Value
eventCategory Checkout
eventAction Checkout

Ecommerce data:

action checkout
data Product details of all selected units

Step 4

Transcation data is sent immediately with the pageview hit.

Transaction consits of a purchase action data and product details of all selected units.

Action data:

Field Value Example
id Booking number 9876-135-M-2017
affiliation MaxBooking.com MaxBooking.com
revenue Total price 459.00
coupon Promo code SUMMER

Notes:

  • Page reload doesn't affect Google Analytics data because transactions use unique identifiers.

Widget

The standard MaxBooking widget is embedded into the property website via an iframe and therefore does not have direct access to the website data. To ensure Google Analytics sessions are not interrupted, the client ID is passed over using the HTML5 API method window.postMessage().

Message exchange sequence:

  • The widget requests the client id by sending send_google_analytics_client_id to the top window.
  • Top window responds with a message in the following format {"clientId":"<client-id>"}.
  • The widget receives the client ID and uses it to send a hit.

If there is no response from the top window in 100ms, the hit is sent without the client ID.