The addFlightBooking
method passes information from your site to Monetate when a customer purchases a flight. This method consists of eight required attributes and seven optional attributes.
Required Attributes
These attributes are required with the addFlightBooking
method:
depDate
— A string that includes the flight's departure date in YYYYMMDD formatdestination
— A string that includes the flight's destination (airport or city)origin
— A string that includes the flight's point of origin (airport or city)travelers
— An integer that includes the number of travelers on a flightpurchaseId
— A string that includes the order ID for a purchased flightpid
— A string without spaces that includes an ID used to identify a flightquantity
— An integer that includes the number of flights bookedunitPrice
— A string that includes the flight's price in the format XX.XX
Optional Attributes
These attributes are optional for the addFlightBooking
method:
adults
— An integer that includes the total number of adults booking a flightinfants
— An integer that includes the total number of infants booking a flightminors
— An integer that includes the total number of minors booking a flightseniors
— An integer that includes the total number of seniors booking a flightretDate
— A string that includes the flight's return date in YYYYMMDD format; not used for multiple flightsserviceClass
— A string that includes the service class for the seats on a flight booked (business, economy, first, etc.)currency
— A string in the ISO 4217 standard (three capital letters and no spaces) that includes the currency used to book the flight
Code Samples
// addFlightBooking Method // Return Flight Example window.monetateQ = window.monetateQ || []; var bookingObject = { // Required 'depDate': ['20160315'], // March 15, 2016 'destination': ['CDG'], 'origin': ['LHR'], 'travelers': [5], // Optional 'adults': [2], 'infants': [1], 'minors': [1], 'seniors': [1], 'retDate': ['20160421'], // April 21, 2016 'serviceClass': ['Economy'] }; window.monetateQ.push(['addFlightBooking', bookingObject, 'LON12345', 'LHR-CDG', 1, '1200.00', // Optional 'EUR' ]); window.monetateQ.push(['trackData']);
// addFlightBooking Method // Multi-Flight Example window.monetateQ = window.monetateQ || []; var bookingObject = { // Required 'depDate': ['20160315', '20160320'], // March 15, 2016 and March 20, 2016 'destination': ['CDG', 'TXL'], 'origin': ['LHR', 'CDG'], 'travelers': [5], // Optional 'adults': [2], 'infants': [1], 'minors': [1], 'seniors': [1], 'serviceClass': ['Economy'] }; window.monetateQ.push(['addFlightBooking', bookingObject, 'LON12345', 'LHR-CDG', 1, '1200.00', // Optional 'EUR' ]); window.monetateQ.push(['trackData']);