Web setup for travel

This is for:

Developer

In this article, we’ll walk you through the steps you need to take to get Coveo Qubit set up on your site for Experimentation Hub clients working in the travel vertical.

Who should use this guide?

This guide is recommended for Experimentation Hub clients looking to implement our Smartserve script (required to drive basic data collection) and those essential QProtocol events required to drive experiences, segmentation, and analytics.

Don’t forget to checkout our Events page for the full QP event specification.

Setup tasks

Perform these tasks in the following order:

  1. Add the UV API script

  2. Add the Smartserve script

  3. Emit events

Add the UV API script

Add on every page:

<script>
!function(){function n(){function n(n){p.level=n}function e(n,e){p.info(n,"event emitted"),e=c(e||{}),e.meta=e.meta||{},e.meta.type=n,u.push(e),r(),v.listeners=f(v.listeners,function(n){return!n.disposed})}function o(n,e,o){function r(){return p.info("Replaying events"),t(function(){s(v.events,function(t){c.disposed||l(n,t.meta.type)&&e.call(o,t)})}),f}function i(){return p.info("Disposing event handler"),c.disposed=!0,f}p.info("Attaching event handler for",n);var c={type:n,callback:e,disposed:!1,context:o||window};v.listeners.push(c);var f={replay:r,dispose:i};return f}function t(n){p.info("Calling event handlers"),a++;try{n()}catch(n){p.error("UV API Error",n.stack)}a--,r()}function r(){if(0===u.length&&p.info("No more events to process"),u.length>0&&a>0&&p.info("Event will be processed later"),u.length>0&&0===a){p.info("Processing event");var n=u.shift();v.events.push(n),t(function(){s(v.listeners,function(e){if(!e.disposed&&l(e.type,n.meta.type))try{e.callback.call(e.context,n)}catch(n){p.error("Error emitting UV event",n.stack)}})})}}function i(n,e,o){var t=v.on(n,function(){e.apply(o||window,arguments),t.dispose()});return t}function s(n,e){for(var o=n.length,t=0;t<o;t++)e(n[t],t)}function c(n){var e={};for(var o in n)n.hasOwnProperty(o)&&(e[o]=n[o]);return e}function l(n,e){return"string"==typeof n?n===e:n.test(e)}function f(n,e){for(var o=n.length,t=[],r=0;r<o;r++)e(n[r])&&t.push(n[r]);return t}var u=[],a=0,p={info:function(){p.level>n.INFO||console&&console.info&&console.info.apply(console,arguments)},error:function(){p.level>n.ERROR||console&&console.error&&console.error.apply(console,arguments)}};n.ALL=0,n.INFO=1,n.ERROR=2,n.OFF=3,n(n.ERROR);var v={on:o,emit:e,once:i,events:[],listeners:[],logLevel:n};return v}"object"==typeof module&&module.exports?module.exports=n:window&&void 0===window.uv&&(window.uv=n())}();
</script>

Add the smartserve.js script

Add on every page:

<script src='https://static.goqubit.com/smartserve-<YOUR_PROPERTY_ID>.js' ></script>

Emit events

Events are emitted using the UV API and must conform to a certain schema. Events are emitted using JavaScript, usually on page load or when a new view is rendered on a single page app. An example is shown below:

uv.emit('theEventType', {
  aStringField: 'theValueWhichMustBeTheCorrectType',
  aNumberField: 3,
  aBooleanField: false
})

Travel flow and events

Typical travel site flow

travel flow

Indicative events by page type

In the following table, we show an indicative breakdown of a site by page type, alongside the events that could be emitted on each page. This represents a typical set up and there may be exceptions:

Page Events

All

trView, trUser

Home

trView, trUser

Product

trView, trUser, trPackageItem, trPackageSummary

Search results page

trView, trUser, trSearch

Checkout

trView, trUser, trPackageItemCheckout, trPackageCheckoutSummary

Confirmation

trView, trUser, trPackageItemTransaction, trPackageTransactionSummary

Indicative events by activity

In addition to the above events, in the following table we show the events that correspond to common visitor activities, such as registration, login, and search:

Activity Events

Registration

trUserSignup

Login

trView,trUserLogin

Enquiry

trFormSubmission

Get quote

trFormSubmission

Newsletter signup

trFormSubmission

Search

trSearch

Qubit recommends the following events should be emitted:

These events represent the starting point for setting up Qubit on your site. Additional events are required to drive Qubit’s programmatic experiences.

For each of the above events, we identify those fields that are required to integrate with Qubit technology. We also detail other fields that we recommend are emitted for data completeness. For both required and recommended fields, we identify those that apply to all sites and those that only apply to journey, accommodation, ancillary, and experience.

Other Qubit products have different event field requirements, which will be discussed during onboarding.

trView

The trView event reports a page view and is a special event because it is required by smartserve.js for data collection and processing. It’s therefore essential that every page emits an trView event and that it is emitted before any other event.

Warning

Any CEH events emitted before the first trView event are considered invalid. Web and mobile applications emit CEH view events whenever a view is rendered.

Emit trView on every page.

Required fields:

  • type

  • subtypes

  • language

  • country

  • currency

Example schema

Field (JS Data Type) Description

type (String)

The type of view. Can be one of account, basket, category, checkout, confirmation, contact, content, help, home, product,registration, search

subtypes (Array of Strings)

An unordered list of subtypes to describe the view

language (String)

The language used in this view. Must be an IETF language tag (for example, en-gb, en-us)

country (String)

The selected country for the view. Must be an ISO 3166-1 alpha-2 code (for example, GB, FR, US)

currency (String)

The ISO 4217 currency code for the user, (for example, GBP, USD)

Example JavaScript

uv.emit('trView', {
  type: 'home',
  subtypes: ['Holidays', 'All Inclusive', 'Luxury'],
  language: 'en-us',
  country: 'US',
  currency: 'USD'
})

Setup guidelines

type

  • Use only lower-case characters

  • Custom names can be used for unique page types that are not covered by our recommended page types such as home, category, product

  • It is acceptable to use null in the absence of a page type

subtypes

  • Where possible, the array should be aligned with the same structure used for the page breadcrumb, if available

language, country, currency

  • These fields are only required if your site has multiple languages, currencies, or shipping countries. If not, they can be safely omitted

trUser

The trUser event is emitted once per view and reports visitor metadata. The event should be emitted on every page as long as there is data available for the user.

For many websites, the event will be present and well populated when the visitor logs on. Sites with a newsletter subscription form that the visitor has previously submitted, might be able to populate the name and email address for the visitor using the data collected on form submission.

Can we omit or hash user.email to comply with our internal data privacy policies?

In short, yes. Both user Id and email can be hashed. However, be aware that to ingest data for use in the Qubit platform, the user Id and email in the provided dataset must be hashed in the same way.

Alternatively, you may choose to omit user.email. The omission of a required field does not prevent the event itself from being sent to Qubit and being processed by our data pipeline–you’ll see a validation error in the Validation Dashboard for the event though.

For further information about our role as a data processor and our obligations and commitments under GDPR, refer to Personal Data and in particular How is customer data treated? For legal clarifications, contact Coveo Support.

Emit trUser events on every page with details of the visitor.

Required fields:

All sites

  • user.id

  • user.email

All sites

  • user.isGuest

  • loyalty.tier

  • loyalty.tierPoints

  • loyalty.membershipType

  • loyalty.membershipPoints

Example schema

Field (JS Data Type) Description

user.id (String)

A unique user Id. Can be a hash of the username and/or email address

user.email (String)

The visitor’s primary email address

user.isGuest (Boolean)

True if the visitor is a guest without a registered account

user.loyalty.tier (String)

The loyalty program tier that the visitor belongs to

user.loyalty.tierPoints (Number)

The number of tier points

user.loyalty.membershipType (String)

The type of loyalty membership

user.loyalty.membershipPoints (Number)

The number of points for the membership

Example JavaScript

uv.emit('trUser', {
  user: {
    id: 'js123xyz',
    email: 'John.Smith@gmail.com',
    isGuest: true,
    loyalty: {
      tier: 'silver',
      tierPoints: 10,
      membershipType: 'Clearsky Rewards',
      membershipPoints: 56
    }
  }
})

Setup guidelines

user.id

  • It is acceptable to emit a hashed user Id

user.email

  • It is acceptable to emit a hashed email

trUserLogin

Emitted when a visitor logs in.

Note

Emit trUserLogin on successful login with details of the logged in user.

Required fields:

All sites

  • user.id

Example schema

Field (JS Data Type) Description

user.id (String)

A unique user Id. Can be a hash of the username and/or email address

Example JavaScript

uv.emit('trUserLogin',{
  user: {
    id: 'joeBloggs',
  }
})

trUserSignup

Emitted when a visitor signs up for a newsletter or event.

Note

Emit trUserSignup on signup with details of the visitor submitting the signup request.

Required fields:

All sites

  • user.id

All sites

  • type

  • name

Example schema

Field (JS Data Type) Description

user.id (String)

A unique user Id. Can be a hash of the username and/or email address

type (String)

The item that the visitor has signed up for (for example, newsletter)

name (String)

A meaningful name unique to the sign up (for example, weekly signup)

Example JavaScript

uv.emit('trUserSignup',{
  user: {
    id: "2861102bace6e6620948564f0ce0a7cd",
    },
  type: 'newsletter',
  name: 'weekly signup'
})

trFormSubmission

Examples of a form submission include getting a quote, subscribing to a newsletter, or contacting customer support.

For travel sites that are non-transactional, for example, those sites that provide quotations, this event is very important as it is used to count conversions.

Note

Emit trFormSubmission on form submission with a unique Id to identity the form submission and an accompanying form name.

All sites

  • submissionId

  • name

Example schema

Field (JS Data Type) Description

submissionId (String)

A unique Id to identify the form submission

name (String)

The name of the submitted form

Example JavaScript

uv.emit('trFormSubmission',{
  submissionId: 'ContactUs-856',
  name: 'ContactUsEnquiry'
})

trSearch

Emitted when a visitor performs a search on a site. This is a key event because it is usually the first step taken by a visitor when booking a trip and allows you to gather rich information early in the visitor journey, which is very valuable for segmentation.

Note

Emit trSearch when a visitor performs a search to identify the search parameters.

All sites

  • searchType

  • numberOfAdults

  • numberOfChildren

  • numberOfInfants

  • numberOfStudents

  • numberOfTeenagers

  • totalNumber

  • startTs

  • endTs

  • exactDuration

  • minDuration

  • maxDuration

  • exactPrice

  • minPrice

  • maxPrice

  • origin.country

  • origin.countryCode

  • origin.region

  • origin.locality

  • origin.name

  • origin.code

  • destination.country

  • destination.countryCode

  • destination.region

  • destination.locality

  • destination.name

  • destination.code

  • leadTime

  • boardBasis

  • roomFacilities

  • roomTypes

  • numberOfRooms

  • exactRating

  • minRating

  • maxRating

  • outboundFares

  • inboundFares

  • flexibleDates

  • results.pagination

  • results.resultCount

  • results.layout

  • results.sortBy

  • results.sortDirection

Example schema

Field (JS Data Type) Description

searchType (String)

The search type

numberOfAdults (Number)

The number of adults in the search

numberOfChildren (Number)

The number of children in the search

numberOfInfants (Number)

The number of infants in the search

numberOfStudents (Number)

The number of students in the search

numberOfTeenagers (Number)

The number of teenagers in the search

totalNumber (Number)

The total number of travelers in the search

startTs (Number)

The epoch time in milliseconds for the departure date

endTs (Number)

The epoch time in milliseconds for the return date

exactDuration (Number)

The exact number of nights searched for

minDuration (Number)

The minimum number of nights searched for

maxDuration (Number)

The maximum number of nights searched for

exactPrice.value (Number)

The exact price searched for, rounded to 2 decimal places

exactPrice.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

minPrice.value (Number)

The minimum price searched for, rounded to 2 decimal places

minPrice.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

maxPrice.value (Number)

The maximum price searched for, rounded to 2 decimal places

maxPrice.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

origin.country (String)

The country searched for. For a flight, this would be the departure airport or city

origin.countryCode (String)

The ISO 3166-1 alpha-2 country code that corresponds to the country searched for (for example, GB, US, FR)

origin.region (String)

The region searched for, that is, state in the USA or county in the UK

origin.locality (String)

The town or city searched for

origin.name (String)

A name specific to this location (for example, airport name)

origin.code (String)

A code specific to this location (for example, airport code)

destination.country (String)

The country searched for. For a flight, this would be the arrival airport or city

destination.countryCode (String)

The ISO 3166-1 alpha-2 country code that corresponds to the country searched for (for example, GB, US, FR)

destination.region (String)

The region searched for, that is, state in the USA or county in the UK

destination.locality (String)

The town or city searched for

destination.name (String)

A name specific to this location (for example, airport name)

destination.code (String)

A code specific to this location (for example, airport code)

leadTime (Number)

The number of days between the day of the search and the startTs

boardBasis (Array of Strings)

The type of accommodation board searched for

roomFacilities (Array of Strings)

The room facilities searched for

roomTypes (Array of Strings)

The types of rooms searched for

numberOfRooms (Number)

The number of rooms searched for

exactRating (Number)

The exact rating of the room searched for

minRating (Number)

The minimum rating of the room searched for

maxRating (Number)

The maximum rating of the room searched for

outboundFares (Array of Strings)

The outbound journey fares searched for

inboundFares (Array of Strings)

The inbound journey fares searched for

flexibleDates (Boolean)

Whether the start and end dates are flexible

results.pagination (Number)

The number of search result items shown per page

results.resultCount (Number)

The number of returned search items matching the query and/or filters

results.layout (String)

The user’s chosen visual layout for search results (for example, list, grid, or map)

results.sortBy (String)

The column selected by the visitor to sort columns by

results.sortDirection (String)

The sort direction for the column selected to sort results by (for example, ascending, descending)

Example JavaScript

uv.emit('trSearch',{
  searchType: 'One-way Flight',
  numberOfAdults: 2,
  numberOfChildren: 5,
  numberOfInfants: 2,
  numberOfStudents: 2,
  numberOfTeenagers: 2,
  totalNumber: 9,
  startTs: 1454585576191,
  endTs: 1455926400000,
  exactDuration: 16,
  minDuration: 1,
  maxDuration: 6,
  exactPrice: {
    value: 9.99,
    currency: 'USD'
  },
  minPrice: {
    value: 9.99,
    currency: 'USD'
  },
  maxPrice: {
    value: 9.99,
    currency: 'USD'
  },
  origin: {
    country: 'Austria',
    countryCode: 'AT',
    region: 'Carinthia',
    locality: 'Villefranche sur saone',
    name: 'Ouagadougou Airport',
    code: 'LYS'
  },
  destination: {
    country: 'Austria',
    countryCode: 'AT',
    region: 'Carinthia',
    locality: 'Villefranche sur saone',
    name: 'Ouagadougou Airport',
    code: 'LYS'
  },
  leadTime: 42,
  boardBasis: [
    'All Inclusive',
    'Room Only'
  ],
  roomFacilities: [
    'A/C',
    'Wifi',
    'Jacuzzi'
  ],
  roomTypes: [
    'Royal Suite',
    'Single Room'
  ],
  numberOfRooms: 3,
  exactRating: 3.5,
  minRating: 3,
  maxRating: 4.5,
  outboundFares: [
    'Flexible First Class'
  ],
  inboundFares: [
    'Cheap Cheap Economy'
  ],
  flexibleDates: true,
  results: {
    pagination: 10,
    resultCount: 15,
    layout: 'grid',
    sortBy: 'price',
    sortDirection: 'ascending'
  }
})

trPackageItem

This event is emitted on products pages, which are considered to be outside of the booking/checkout funnel.

Each trPackageItem event will contain a packageItemType, which describes either a journey, accommodation, ancillary, or experience.

For packaged holidays, the event will contain a packageItemType for each part of the package: flight, accommodation, ancillary(ies), experience.

A booking that only includes flights, would typically contain 1 packageItemType, with the value journey for the outbound flight and another packageItemType for the inbound flight, as shown in the following example:

uv.emit('trPackageItem',{
  package: {
    id: 'TRP201214'
  },
  eventType: 'detail',
  packageItem: {
    id: 'TRP201215',
    packageItemType: 'journey',
    journey: {
      journeyType: 'outbound'
   }
 }
})

Refer to the following table for a few example scenarios showing how to emit this event:

Vertical Package Package item type

Transportation

One-way flight

1 journey package item

Transportation

Return flight

2 journey package items

Transportation

Multi-city flight

1 journey package item for each leg

Transportation

One-way flight London to Sydney, stopover in Dubai

1 journey package item

Hospitality

Hotel stay

1 accommodation package item

Packaged Holiday

Package

2 journey package items1 accommodation package item

See Explanation of Package Types for more information.

Emit trPackageItem events on product detail pages for each package item shown.

Required fields:

All sites

  • trPackageItem.packageItem.packageItemType

Ancillary

  • trPackageItem.packageItem.ancillary.ancillaryType

#

All sites

  • trPackageItem.package.id

  • trPackageItem.eventType

  • trPackageItem.packageItem.id

Journey

  • trPackageItem.journey.id

  • trPackageItem.packageItem.journey.journeyType

  • trPackageItem.packageItem.journey.originName

  • trPackageItem.packageItem.journey.originCode

  • trPackageItem.packageItem.journey.destinationName

  • trPackageItem.packageItem.journey.destinationCode

  • trPackageItem.packageItem.journey.departureTs

  • trPackageItem.packageItem.journey.arrivalTs

  • trPackageItem.packageItem.journey.fare

  • trPackageItem.packageItem.journey.originCountry

  • trPackageItem.packageItem.journey.destinationCountry

Accommodation

  • trPackageItem.accommodation.id

  • trPackageItem.packageItem.accommodation.rating

  • trPackageItem.packageItem.accommodation.normalizedRating

  • trPackageItem.packageItem.accommodation.stars

  • trPackageItem.packageItem.accommodation.boardBasis

  • trPackageItem.packageItem.accommodation.travelLocation.country

  • trPackageItem.packageItem.accommodation.travelLocation.locality

  • trPackageItem.packageItem.accommodation.travelLocation.name

  • trPackageItem.packageItem.accommodation.travelLocation.code

Ancillary

  • trPackageItem.ancillary.id

Experience

  • trPackageItem.packageItem.experience.id

  • trPackageItem.packageItem.experience.name

  • trPackageItem.packageItem.experience.location.country

  • trPackageItem.packageItem.experience.location.locality

  • trPackageItem.packageItem.experience.location.name

  • trPackageItem.packageItem.experience.location.code

  • trPackageItem.packageItem.experience.startTs

  • trPackageItem.packageItem.experience.endTs

Example schema

In the following example, we detail the schema structure of the trPackageItem event. This schema will be extended with the fields that correspond to the packageItemType implemented:

Field (JS Data Type) Description

package.id (String)

An Id unique to the trip/package

eventType (String)

The type of package item event (for example, detail, or linked_product)

packageItem.id (String)

An Id unique to the package item

packageItem.packageItemType (String)

Describes the type of package item (for example, journey, accommodation, ancillary, or experience)

Example JavaScript

In the following example, we show an example of the trPackageItem event:

uv.emit('trPackageItem',{
  package: {
    id: 'TRP201214'
  },
  eventType: 'detail',
  packageItem: {
    id: 'TRP201218',
    packageItemType: 'journey'/'accommodation'/'ancillary'/'experience' // each packageType will have a set of fields for that specific type
  }
})

Example schema for packageItemType: journey

Field (JS Data Type) Description

journey.id (String)

An Id unique to the journey

journey.journeyType (String)

The type of journey, whether it’s inbound or outbound

journey.originName (String)

The name that corresponds to the departure point (for example, Heathrow)

journey.originCode (String)

The origin code, IATA for airports

journey.destinationName (String)

The name that corresponds to the arrival point (for example, Milan Malpensa)

journey.destinationCode (String)

The destination code, IATA for airports

journey.departureTs (Number)

The departure epoch time in milliseconds

journey.arrivalTs (Number)

The arrival epoch time in milliseconds

journey.price.value (Number)

The price of the journey, rounded to 2 decimal places

journey.price.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

journey.fare (String)

The fare class chosen for this journey

journey.originCountry (String)

The origin country

journey.destinationCountry (String)

The destination country

Example JavaScript for packageItemType: journey

uv.emit('trPackageItem',{
  package: {
    id: 'TRP201214'
  },
  eventType: 'detail',
  packageItem: {
    id: 'TRP201215',
    packageItemType: 'journey',
    journey: {
      id: 'FL0989',
      journeyType: 'outbound',
      originName: 'John F Kennedy International',
      originCode: 'JFK',
      destinationName: 'Los Angeles International',
      destinationCode: 'LAX',
      departureTs: 1454585859331,
      arrivalTs: 1454595869331,
      price: {
        value: 299.99,
        currency: 'USD'
      },
      fare: 'Premium Cabin',
      originCountry: 'United States of America',
      destinationCountry: 'United States of America'
   }
 }
})

Example schema for packageItemType: accommodation

Field (JS Data Type) Description

accommodation.id (String)

An Id unique to the journey

accommodation.rating (Number)

The average rating of the accommodation, between 0 and 10

accommodation.normalizedRating (Number)

A normalized rating between 0 and 1 (for example, 6/10 is normalized to 0.6)

accommodation.stars (Number)

The number of stars awarded to the accommodation

accommodation.boardBasis (String)

The board basis for the accommodation (for example, Full Board, Half Board, Bed and Breakfast)

accommodation.travelLocation.country (String)

The country of the accommodation

accommodation.travelLocation.locality (String)

The town or city of the accommodation

accommodation.travelLocation.name (String)

A name specific to this location

accommodation.travelLocation.code (String)

A code specific to this location

Example JavaScript for packageItemType: accommodation

uv.emit('trPackageItem',{
  package: {
    id: 'TRP201214'
  },
  eventType: 'detail',
  packageItem: {
    id: 'TRP201215',
    packageItemType: 'accommodation',
    accommodation: {
      id: 'AC221144',
      rating:6,
      normalizedRating: 0.4,
      stars: 4,
      boardBasis: 'All inclusive',
      travelLocation: {
        country: 'United States',
        region: 'New York',
        locality: 'Manhatten',
        code: 'NYCMAN'
      }
    }
  }
})

Example schemas for packageItemType: ancillary

In the following example schema, we present details of a few of the possible types of ancillaries.

Typically, for all ancillary types, you would emit an id and type.

Field (JS Data Type) Description

ancillary.ancillaryType (String)

The type of ancillary (for example, insurance,luggage,meal,parking,seats,transfers,vehicleRental,pet,lounge,wifi,priority,sportsEquipment,donation,towel)

ancillary.insurance.id (String)

An Id unique to the insurance ancillary

ancillary.insurance.type (String)

The type of insurance (for example, travel insurance)

ancillary.insurance.coverage (Number)

The number of insurance policies booked (for example, if travel insurance policies were selected for 2 people, this would be 2)

ancillary.luggage.id (String)

An Id unique to the luggage ancillary

ancillary.luggage.type (String)

The type of luggage in the ancillary (for example, carry on)

ancillary.luggage.weight (Number)

The max weight of the luggage ancillary, in kilograms

ancillary.seats.id (String)

An Id unique to the seats ancillary

ancillary.seats.type (String)

The type of seat booking (for example, free upgrade)

ancillary.seats.tier (String)

The seating class

ancillary.seats.seatNumber (Array of Strings)

The seat numbers booked

ancillary.priority.id (String)

An Id unique to the priority ancillary

ancillary.type (String)

The type of priority this ancillary provides

Example JavaScript for packageItemType: ancillary

Insurance

uv.emit('trPackageItem',{
  package: {
    id: 'TRP201214'
  },
  eventType: 'detail',
  packageItem: {
    id: 'TRP201215',
    packageItemType: 'ancillary',
    ancillary: {
      ancillaryType: 'insurance',
      insurance: {
        id: 'INS1234',
        type: 'Travel Insurance',
        coverage: 2
      }
    }
  }
})

Luggage

uv.emit('trPackageItem',{
  package: {
    id: 'TRP201214'
  },
  eventType: 'detail',
  packageItem: {
    id: 'TRP201215',
    packageItemType: 'ancillary',
    ancillary: {
      ancillaryType: 'luggage',
      luggage: {
        id: 'LUG123',
        type: 'Carry on',
        weight: 32
      }
    }
  }
})

Seats

uv.emit('trPackageItem',{
  package: {
    id: 'TRP201214'
  },
  eventType: 'detail',
  packageItem: {
    id: 'TRP201215',
    packageItemType: 'ancillary',
    ancillary: {
      ancillaryType: 'seats',
      seats: {
        id: 'SEAT123',
        type: 'Free upgrade',
        tier: 'Economy Plus',
        seatNumber: [
          '1A',
          '35D',
          '35E'
        ]
      }
    }
  }
})

Priority boarding

uv.emit('trPackageItem',{
  package: {
    id: 'TRP201214'
  },
  eventType: 'detail',
  packageItem: {
    id: 'TRP201215',
    packageItemType: 'ancillary',
    ancillary: {
      ancillaryType: 'priority',
      priority: {
        id: 'PRIO123',
        type: 'Priority Boarding'
      }
    }
  }
})

Vehicle rental

uv.emit('trPackageItem',{
  package: {
    id: 'TRP201214'
  },
  eventType: 'detail',
  packageItem: {
    id: 'TRP201215',
    packageItemType: 'ancillary',
    ancillary: {
      ancillaryType: 'vehicleRental',
      vehicleRental: {
        id: 'VEHIO123',
        type: 'Standard Vehicle Rental',
        vendor: 'Excellent Rental Company'
      }
    }
  }
})

Example schema for packageItemType: experience

Field (JS Data Type) Description

experience.id (String)

An Id unique to the experience

experience.name (String)

The name of the experience

experience.location.country (String)

The country where the experience takes place

experience.location.locality (String)

The town or city where the experience takes place

experience.location.name (String)

A name specific to the location of the experience

experience.location.code (String)

A code specific to the location of the experience

experience.startTs(Number)

The start epoch time in milliseconds

experience.endTs (Number)

The finish epoch time in milliseconds

Example JavaScript for packageItemType: experience

uv.emit('trPackageItem',{
  package: {
    id: 'TRP201220'
  },
  eventType: 'detail',
  packageItem: {
    id: 'TRP201221',
    packageItemType: 'experience',
    experience: {
      id: 'TRP201228',
      name: 'An amazing winter experience',
      location:{
        country: 'Finland',
        locality: 'Helsinki',
        name: 'Helsinki City',
        code: 'HelCC',
      },
      startTs: 1454585859331,
      endTs: 1454595869331
    }
  }
})

trPackageItemCheckout

This event is similar to trPackageItem but is emitted on the checkout page and therefore inside the booking/checkout funnel.

Emit trPackageItemCheckout events on checkout pages for each package item the visitor has in their package.

Required fields:

All sites

  • trPackageItemCheckout.packageItem.packageItemType

Ancillary

  • trPackageItemCheckout.packageItem.ancillary.ancillaryType

All sites

  • trPackageItemCheckout.eventType

  • trPackageItemCheckout.package.id

  • trPackageItemTransaction.packageItem.id

Journey

  • trPackageItemCheckout.packageItem.journey.id

  • trPackageItemCheckout.packageItem.journey.journeyType

  • trPackageItemCheckout.packageItem.journey.originName

  • trPackageItemCheckout.packageItem.journey.originCode

  • trPackageItemCheckout.packageItem.journey.destinationName

  • trPackageItemCheckout.packageItem.journey.destinationCode

  • trPackageItemCheckout.packageItem.journey.departureTs

  • trPackageItemCheckout.packageItem.journey.arrivalTs

  • trPackageItemCheckout.packageItem.journey.fare

  • trPackageItemCheckout.packageItem.journey.originCountry

  • trPackageItemCheckout.packageItem.journey.destinationCountry

Accommodation

  • trPackageItemCheckout.packageItem.accommodation.id

  • trPackageItemCheckout.packageItem.accommodation.rating

  • trPackageItemCheckout.packageItem.accommodation.normalizedRating

  • trPackageItemCheckout.packageItem.accommodation.stars

  • trPackageItemCheckout.packageItem.accommodation.boardBasis

  • trPackageItemCheckout.packageItem.accommodation.travelLocation.country

  • trPackageItemCheckout.packageItem.accommodation.travelLocation.locality

  • trPackageItemCheckout.packageItem.accommodation.travelLocation.name

  • trPackageItemCheckout.packageItem.accommodation.travelLocation.code

Experience

  • trPackageItemCheckout.packageItem.packageItem.experience.id

  • trPackageItemCheckout.packageItem.packageItem.experience.name

  • trPackageItemCheckout.packageItem.packageItem.experience.location.country

  • trPackageItemCheckout.packageItem.packageItem.experience.location.locality

  • trPackageItemCheckout.packageItem.packageItem.experience.location.name

  • trPackageItemCheckout.packageItem.packageItem.experience.location.code

  • trPackageItemCheckout.packageItem.packageItem.experience.startTs

  • trPackageItemCheckout.packageItem.packageItem.experience.endTs

Example schema

Field (JS Data Type) Description

package.id (String)

An Id unique to the trip/package

eventType (String)

The type of package item event (for example, listing, detail, or linked_product)

packageItem.id (String)

An Id unique to the package item

packageItem.packageItemType (String)

Describes the type of package item (for example, journey, accommodation, ancillary, or experience)

Example JavaScript

uv.emit('trPackageItemCheckout',{
  package: {
    id: 'TRP201214'
  },
  eventType: 'detail',
  packageItem: {
    id: 'TRP201216',
    packageItemType: 'journey'/'accommodation'/'ancillary' // each packageItemType will have a set of fields for that specific type
  }
})

trPackageItemTransaction

This event is similar to trPackageItem but is emitted on the confirmation page and contains additional fields for transaction data.

Transaction events are very important because they report revenue for your website.

This event collects granular information about individual items contained within a transaction. It enables segmentation based on preferences, including destinations, journey type, etc.

Emit trPackageItemCheckout events for each package item the visitor has purchased.

Required fields:

All sites

  • trPackageItemTransaction.packageItem.packageItemType

  • trPackageItemTransaction.transaction.id

Ancillary

  • trPackageItemTransaction.packageItem.ancillary.ancillaryType

  • trPackageItemTransaction.eventType

  • trPackageItemTransaction.package.id

  • trPackageItemTransaction.packageItem.id

Journey

  • trPackageItemTransaction.packageItem.journey.id

  • trPackageItemTransaction.packageItem.journey.journeyType

  • trPackageItemTransaction.packageItem.journey.originName

  • trPackageItemTransaction.packageItem.journey.originCode

  • trPackageItemTransaction.packageItem.journey.destinationName

  • trPackageItemTransaction.packageItem.journey.destinationCode

  • trPackageItemTransaction.packageItem.journey.departureTs

  • trPackageItemTransaction.packageItem.journey.arrivalTs

  • trPackageItemTransaction.packageItem.journey.fare

  • trPackageItemTransaction.packageItem.journey.originCountry

Accommodation

  • trPackageItemTransaction.packageItem.accommodation.id

  • trPackageItemTransaction.packageItem.accommodation.stars

  • trPackageItemTransaction.packageItem.accommodation.travelLocation.country

  • trPackageItemTransaction.packageItem.accommodation.travelLocation.locality

  • trPackageItemTransaction.packageItem.accommodation.travelLocation.name

  • trPackageItemTransaction.packageItem.accommodation.travelLocation.code

Experience

  • trPackageItemTransaction.packageItem.experience.id

  • trPackageItemTransaction.packageItem.experience.name

  • trPackageItemTransaction.packageItem.experience.location.country

  • trPackageItemTransaction.packageItem.experience.location.locality

  • trPackageItemTransaction.packageItem.experience.location.name

  • trPackageItemTransaction.packageItem.experience.location.code

  • trPackageItemTransaction.packageItem.experience.startTs

  • trPackageItemTransaction.packageItem.experience.endTs

Example schema

Field (JS Data Type) Description

package.id (String)

An Id unique to the trip/package

eventType (String)

The type of package item event (for example, listing, detail, or linked_product)

packageItem.id (String)

An Id unique to the package item

packageItem.packageItemType (String)

Describes the type of package item (for example, journey, accommodation, ancillary, or experience)

transaction.id (String)

A unique transaction Id

Example JavaScript

uv.emit('trPackageItemTransaction',{
  package: {
    id: 'TRP201214'
  },
  eventType: 'detail',
  packageItem: {
    id: 'TRP201216',
    packageItemType: 'journey'/'accommodation'/'ancillary' // each packageItemType will have a set of fields for that specific type
  },
  transaction: {
    id: '83748372'
  }
})

trPackageSummary

This event contains all of the high-level information about the viewed/selected/purchased package and is the equivalent of a shopping basket summary.

The package Id should capture information for the whole package and not just the package items. Where there is a single package item, the information for the package and package item might be the same.

Emit trPackageSummary events for each package shown on a product detail page and once per pageview/context.

All sites

  • trPackageSummary.package.id

  • trPackageSummary.package.numberOfAdults

  • trPackageSummary.package.numberOfChildren

  • trPackageSummary.package.numberOfInfants

  • trPackageSummary.package.totalNumber

  • trPackageSummary.package.startTs

  • trPackageSummary.package.endTs

  • trPackageSummary.package.duration

  • trPackageSummary.package.name

  • trPackageSummary.package.type

  • trPackageSummary.package.total

Example schema

Field (JS Data Type) Description

package.id (String)

An Id unique to the trip/package

package.numberOfAdults (Number)

The number of adults in the package

package.numberOfChildren (Number)

The number of children in the package

package.numberOfInfants (Number)

The number of infants in the package

package.totalNumber (Number)

The total number of people in the package

package.startTs (Number)

The epoch time in milliseconds for the package start

package.endTs (Number)

The epoch time in milliseconds for the package en

package.duration (Number)

The duration of the package in nights

package.name (String)

The name of the package

package.type (String)

The type of package (for example, tour, chartered cruise, packaged holiday, flights only)

package.total.value (Number)

The total cost of the package, including tax and discounts, rounded to 2 decimal places

package.total.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

Example JavaScript

uv.emit('trPackageSummary',{
  package: {
    id: 'TRP201214',
    numberOfAdults: 2,
    numberOfChildren: 2,
    numberOfInfants: 1,
    totalNumber: 5,
    startTs: 1454585576191,
    endTs: 1455926400000,
    duration: 16,
    name: 'Winter wonderland',
    type: 'packaged holiday',
    total: {
      value: 2199.99,
      currency: 'USD'
    }
  }
})

trPackageCheckoutSummary

This event is similar to trPackageSummary but is emitted on the checkout page and therefore inside the booking/checkout funnel.

Emit trPackageCheckoutSummary events on checkout pages for the package the visitor has in their basket.

All sites

  • trPackageCheckoutSummary.package.id

  • trPackageCheckoutSummary.package.numberOfAdults

  • trPackageCheckoutSummary.package.numberOfChildren

  • trPackageCheckoutSummary.package.numberOfInfants

  • trPackageCheckoutSummary.package.totalNumber

  • trPackageCheckoutSummary.package.startTs

  • trPackageCheckoutSummary.package.endTs

  • trPackageCheckoutSummary.package.duration

  • trPackageCheckoutSummary.package.name

  • trPackageCheckoutSummary.package.type

  • trPackageCheckoutSummary.package.total

  • trPackageCheckoutSummary.step

Example schema

Field (JS Data Type) Description

package.id (String)

An Id unique to the trip/package

package.numberOfAdults (Number)

The number of adults in the package

package.numberOfChildren (Number)

The number of children in the package

package.numberOfInfants (Number)

The number of infants in the package

package.totalNumber (Number)

The total number of people in the package

package.startTs (Number)

The epoch time in milliseconds for the package start

package.endTs (Number)

The epoch time in milliseconds for the package en

package.duration (Number)

The duration of the package in nights

package.name (String)

The name of the package

package.type (String)

The type of package (for example, tour, chartered cruise, packaged holiday, flights only)

package.total.value (Number)

The total cost of the package, rounded to 2 decimal places

package.total.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

step (String)

The current step of the checkout process (for example, Confirmation`, Payment details, Shipping)

Example JavaScript

uv.emit('trPackageCheckoutSummary',{
  package: {
    id: 'TRP201214',
    numberOfAdults: 2,
    numberOfChildren: 2,
    numberOfInfants: 1,
    totalNumber: 5,
    startTs: 1454585576191,
    endTs: 1455926400000,
    duration: 16,
    name: 'Winter wonderland',
    type: 'Packaged holiday',
    total: {
      value: 2199.99,
      currency: 'USD'
    }
  },
  step: 'Confirmation'
})

trPackageTransactionSummary

This event is similar to trPackageSummary but is emitted on the confirmation page and includes additional fields for transaction data.

Most importantly, this event is used to count conversions and the associated revenue.

Emit trPackageTransactionSummary events on confirmation pages for the purchased package.

Required fields:

All sites

  • trPackageTransactionSummary.package.total

  • trPackageTransactionSummary.transaction.id

All sites

  • trPackageTransactionSummary.package.id

  • trPackageTransactionSummary.package.numberOfAdults

  • trPackageTransactionSummary.package.numberOfChildren

  • trPackageTransactionSummary.package.numberOfInfants

  • trPackageTransactionSummary.package.totalNumber

  • trPackageTransactionSummary.package.startTs

  • trPackageTransactionSummary.package.endTs

  • trPackageTransactionSummary.package.duration

  • trPackageTransactionSummary.package.name

  • trPackageTransactionSummary.package.type

  • trPackageTransactionSummary.package.total

Example schema

Field (JS Data Type) Description

package.id (String)

An Id unique to the trip/package

package.numberOfAdults (Number)

The number of adults in the package

package.numberOfChildren (Number)

The number of children in the package

package.numberOfInfants (Number)

The number of infants in the package

package.totalNumber (Number)

The total number of people in the package

package.startTs (Number)

The epoch time in milliseconds for the package start

package.endTs (Number)

The epoch time in milliseconds for the package en

package.duration (Number)

The duration of the package in nights

package.name (String)

The name of the package

package.type (String)

The type of package (for example, tour, chartered cruise, packaged holiday, flights only)

package.total.value (Number)

The total cost of the package, including tax and discounts, rounded to 2 decimal places

package.total.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

transaction.id (String)

A unique transaction Id

Example JavaScript

uv.emit('trPackageTransactionSummary',{
  package: {
    id: 'TRP201214',
    numberOfAdults: 2,
    numberOfChildren: 2,
    numberOfInfants: 1,
    totalNumber: 5,
    startTs: 1454585576191,
    endTs: 1455926400000,
    duration: 16,
    name: 'Winter wonderland',
    type: 'packaged holiday',
    total: {
      value: 2199.99,
      currency: 'USD'
    }
  },
  transaction: {
    id: '83748372'
  }
})