Spec: Flight Events

Event Lifecycle Overview

Browsing

ActionDescription
Products SearchedUser searched for flights

Core Ordering

ActionDescription
Product ViewedUser viewed a product details
Checkout StartedUser initiated the order process (a transaction is created)
Payment Info EnteredUser added payment information
Order CompletedUser completed the order

Browsing

Products Searched

Fire this event when a visitor searches for flights.

This event supports the following semantic properties:

PropertyTypeDescription
flights.$.originStringFlight origin
flights.$.destinationStringFlight destination
flights.$.departure_dateDateDeparture flight’s date
classStringCabin type (first class, coach)
filters.$.typeStringType of filter used (nonstop)
filters.$.valueNumberValue of the filter selected
passengersNumberNumber of passengers/tickets
couponStringCoupon searched with

Example:

analytics.track('Products Searched', {
  flights: [
    {
      origin: 'sfo',
      destination: 'jfk',
      departure_date: 'Sat Jun 18 2016 02:04:00 GMT-0700'
    },
    {
      origin: 'jfk',
      destination: 'phl',
      departure_date: 'Sat Jun 18 2016 09:04:00 GMT-0700'
    }
  ],
  class: 'first-class',
  filters: [
    { type: 'nonstop', value: true },
    { type: 'stops', value: 'no-limit' }
  ],
  passengers: 3,
  coupon: 'MIT2013'
});

Core Ordering

Product Viewed

Fire this event when a visitor views a product. That view might happen on a page, screen, or preview modal.

This event supports the following semantic properties:

PropertyTypeDescription
product_idStringDatabase ID of the flight
flight_typeStringType of flight (outbound, inbound)
originStringFlight origin
destinationStringFlight destination
departure_dateDateDeparture flight’s date
flight_numberStringFlight number of the plane
classStringCabin type (first class, coach)
passengersNumberNumber of passengers/tickets
currencyStringCurrency represented
valueNumberValue of the filter selected

Example:

analytics.track('Product Viewed', {
  product_id: '507f1f77bcf86cd799439011',
  flight_type: 'outbound',
  origin: 'sfo',
  destination: 'jfk',
  departure_date: '6/18/16 6pm'
  flight_number: 'AA484',
  class: 'first-class',
  passengers: 3,
  currency: 'usd',
  value: 293.32
});

Note: The Product Viewed event is aliased to the Viewed Product event from e-commerce v1 spec.

Checkout Started

Fire this event whenever an order/transaction was started. Fire on the page that the customer lands on after they press the checkout button.

This event supports the following semantic properties:

PropertyTypeDescription
checkout_idStringCheckout ID
order_idStringOrder/transaction ID
order_dateDateDate the transaction occurred
affiliationStringStore or affiliation from which this transaction occurred
totalNumberRevenue with discounts and coupons added in

Note that our Google Analytics Ecommerce integration accepts total or revenue, but not both. For better flexibility and total control over tracking, we let you decide how to calculate how coupons and discounts are applied

revenueNumbertransaction coupon redeemed with the transaction
taxNumberTotal tax associated with the transaction
discountNumberTotal discount associated with the transaction
couponStringTransaction coupon redeemed with the transaction
currencyStringCurrency code associated with the transaction
flightsArrayProducts in the order
flights.$.product_idStringDatabase id of the product being viewed
flights.$.flight_typeStringType of flight
flights.$.originStringWhere the passenger is coming fro
flights.$.destinationStringWhere the passenger is going to
flights.$.departure_dateDateThe date of departure
flights.$.flight_numberStringThe number of the flight
flights.$.classStringThe class of the ticket
flights.$.passengersNumberNumber of passengers
flights.$.priceNumberThe price of the ticket
flights.$.booking_windowNumberDays between todays date and flight date

Example:

analytics.track('Checkout Started', {
  checkout_id: 'fksdjfsdjfisjf9sdfjsd9f',
  order_id: '50314b8e9bcf000000000000',
  order_date: 'Sat Jun 15 2016 12:00:00 GMT-0700',
  total: 900,
  revenue: 875,
  tax: 25,
  discount: '25',
  coupon: 'cool-summer',
  currency: 'USD',
  flights: [
    {
      product_id: '507f1f77bcf86cd799439011',
      flight_type: 'outbound',
      origin: 'sfo',
      destination: 'jfk',
      departure_date: 'Sat Jun 18 2016 12:04:00 GMT-0700'
      flight_number: 'AA484',
      class: 'first-class',
      passengers: 3,
      price: 300,
      booking_window: 10
    }
  ]
});

Note: The Checkout Started event is aliased to the Started Order event from Segment’s GA Enhanced E-Commerce Integrations.

Payment Info Entered

Fire this event whenever payment information has been successfully entered.

This event supports the following semantic properties:

PropertyTypeDescription
checkout_idStringCheckout transaction ID
order_idStringOrder ID (optional)

Example:

analytics.track('Payment Info Entered', {
  checkout_id: '39f39fj39f3jf93fj9fj39fj3f',
  order_id: 'dkfsjidfjsdifsdfksdjfkdsfjsdfkdsf'
});

Note: You can have as many or as few steps in the checkout funnel as you’d like. Note that you’ll still need to track the Order Completed event per our standard e-commerce tracking API after you’ve tracked the checkout steps.

Note: The Payment Info Entered event is aliased to the Completed Checkout Step event from Segment’s GA Enhanced E-Commerce Integration.

Order Completed

Fire this event whenever an order/transaction was successfully completed by the customer.

This event supports the following semantic properties:

PropertyTypeDescription
checkout_idStringCheckout ID
order_idStringOrder/transaction ID
order_dateDateDate the transaction occurred
payment_methodStringHow was it paid for? (e.g. Visa)
affiliationStringStore or affiliation from which this transaction occurred
totalNumberRevenue with discounts and coupons added in. Note that our Google Analytics Ecommerce integration accepts total or revenue, but not both. For better flexibility and total control over tracking, we let you decide how to calculate how coupons and discounts are applied
revenueNumbertransaction coupon redeemed with the transaction
taxNumberTotal tax associated with the transaction
discountNumberTotal discount associated with the transaction
couponStringTransaction coupon redeemed with the transaction
currencyStringCurrency code associated with the transaction
flightsArrayProducts in the order
flights.$.product_idStringDatabase id of the product being viewed
flights.$.flight_typeStringType of flight
flights.$.originStringWhere the passenger is coming fro
flights.$.destinationStringWhere the passenger is going to
flights.$.departure_dateDateThe date of departure
flights.$.flight_numberStringThe number of the flight
flights.$.classStringThe class of the ticket
flights.$.passengersNumberNumber of passengers
flights.$.priceNumberThe price of the ticket
flights.$.booking_windowNumberDays between todays date and flight date

Example:

analytics.track('Order Completed', {
  checkout_id: 'fksdjfsdjfisjf9sdfjsd9f',
  order_id: '50314b8e9bcf000000000000',
  order_date: 'Sat Jun 15 2016 12:00:00 GMT-0700',
  payment_method: 'Visa',
  total: 900,
  revenue: 875,
  tax: 25,
  discount: '25',
  coupon: 'cool-summer',
  currency: 'USD',
  flights: [
    {
      product_id: '507f1f77bcf86cd799439011',
      flight_type: 'outbound',
      origin: 'sfo',
      destination: 'jfk',
      departure_date: 'Sat Jun 18 2016 12:04:00 GMT-0700',
      flight_number: 'AA484',
      class: 'first-class',
      passengers: 3,
      price: 300,
      booking_window: 10
    }
  ]
});

Note: The Order Completed event is aliased to the Completed Order event from E-Commerce spec v1.


If you have any questions or see anywhere we can improve our documentation, please let us know or kick off a conversation in the Segment Community!