We have provided a list of Events with their example usage that can be integrated for Applications that belong to the Travel Vertical. Please find them below:
1. Reservation Event
This is used to track the event triggered when an user has completed a Travel Booking on your Application.
You will need to call the below method of MTractionEventTracker Class to track the Reservation event in your Application.
public static void trackReservation(Context context, Reservation reservation);
Reservation reservation = new Reservation(userId, category, dateFrom, locationFrom, revenue, locale, Reservation.PaymentMode.XXX, transactionId);
- Mandatory parameters (Reservation):
- User Id - Unique User Identifier
- Category - Travel Category
- Date From - Travel Booking starting date
- Location From - Location from which the travel will start
- Revenue - Revenue generated from this Reservation event
-
Locale - Currency code used for this purchase. We can get currency code information precisely in either of the following ways:
-
Default from device configuration:
Locale locale = Locale.getDefault();
Note: Recommended for more accuracy. -
Custom setting:
Locale locale = new Locale("JA"/*Language Code*/, "JP" /*Country Code*/);
Note: Click here to view the list of Country codes (ISO-3166) & Language codes (ISO-639).
-
Default from device configuration:
- Reservation.PaymentMode.XXX - XXX can take any of the predefined values, [CREDIT_CARD or DEBIT_CARD or NET_BANKING or GIFT_CARD or PAYMENT_WALLET]
- Transaction Id - Reservation Transaction Identifier
- Optional parameters (Reservation):
- Identifier - Unique Event Identifier
- Product Name - Name of the Travel Product
- Date To - Travel Booking end date
- Location To - Location from which the travel will start
- Loyalty - Loyalty points applied on the booking
- Class - Class of Travel
- Brand - Brand information(if any) on the Travel booking
- Discount - Discount applied for the Travel booking
- Page Name - Page that triggered the Event
- Location - Geolocation of the Event
Sample Code
// Example Longitude & Latitude code (Long / Lat is optional) LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); // Example Dates to passed in as Optional parameters SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date dateFrom = dateFormat.parse("2016-06-17"); Date dateTo = dateFormat.parse("2016-06-24"); // Example Constructor Call with the mandatory parameters Reservation reservation = new Reservation(“123”, “Flights”, dateFrom, “Singapore”, 535.00, Locale.getDefault(), Reservation.PaymentMode.CREDIT_CARD, “123456”); // Examples for other parameters passed with the event (These are optional) Reservation.setIdentifier(“SINDEL12301”) .setProductName(“SIN-DEL Flights”) .setDateTo(dateTo) .setLocationTo(“New Delhi”) .setLoyalty(850.00) .setClass(“economy”) .setBrand(“Singapore Airlines”) .setDiscount(5.00) .setPageName(“Flight Itinerary”) .setLocation(location.getLatitude(), location.getLongitude()); // trackAddToCart method call MTractionEventTracker.trackReservation(this.getApplicationContext(), reservation);
2. Reservation Cancelled Event
This is used to track booking cancellation done by an user in a Travel Application.
YYou will need to call the below method of MTractionEventTracker Class to track the reservation cancelled event in your Application.
Public static void trackCancelReservation(Context context, CancelReservation cancelReservation);
CancelReservation cancelReservation = new CancelReservation(userId, category, dateFrom, locationFrom, refundAmount, locale);
- Mandatory parameters (Reservation Cancelled):
- User Id - Unique User Identifier
- Category - Travel Category
- Date From - Travel Booking starting date
- Location From - Location from which the travel will start
- Refund Amount - Amount to be refunded on cancellation of the Reservation
-
Locale - Currency code used for this purchase. We can get currency code information precisely in either of the following ways:
-
Default from device configuration:
Locale locale = Locale.getDefault();
Note: Recommended for more accuracy. -
Custom setting:
Locale locale = new Locale("JA"/*Language Code*/, "JP" /*Country Code*/);
Note: Click here to view the list of Country codes (ISO-3166) & Language codes (ISO-639).
-
Default from device configuration:
- Optional parameters (Reservation Cancelled):
- Identifier - Unique Event Identifier
- Brand - Brand information(if any) on the Travel booking
- Product Name - Name of the Travel Product
- Date To - Travel Booking end date
- Location To - Location from which the travel will start
- Class - Class of Travel booking
- Transaction Id - Unique Transaction Identifier of the Reservation
- Page Name - Page that triggered the Event
- Location - Geolocation of the Event
Sample Code
// Example Longitude & Latitude code (Long / Lat is optional) LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); // Example Dates to passed in as Optional parameters SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date dateFrom = dateFormat.parse("2016-06-17"); Date dateTo = dateFormat.parse("2016-06-24"); // Example Dates to passed in as Optional parameters CancelReservation cancelReservation = new CancelReservation(“123”, ”Hotels in India”, dateFrom, “Singapore”, 300.00, Locale.getDefault()); // Examples for other parameters passed with the event (These are optional) cancelReservation.setIdentifier(“100001”) .setBrand(“ITC Hotels”) .setProductName(“ITC Sheraton New Delhi”) .setDateTo(dateTo) .setLocationTo(“New Delhi”) .setClass(“Business Suite”) .setTransactionId(“789456123”) .setPageName(“Cancel Booking”) .setLocation(location.getLatitude(), location.getLongitude()); // trackCancelReservation method call MTractionEventTracker.trackCancelReservation(this.getApplicationContext(), cancelReservation);
3. Travel Compare Event
This is used to track the Travel Itinerary Comparison event which lets the users compare various travel options available in the Application.
You will need to call the below method of MTractionEventTracker Class to track the Travel Compare event in your Application.
Public static void trackProductCompared(Context context, ProductCompared productCompared);
// Product List Array Definition List productList = new ArrayList(); // ProductComparedItem Constructor Call ProductComparedItem product = new ProductComparedItem(identifier, productName, price);
- Mandatory parameters (Product Compared Item):
- Identifier - Unique Product Identifier
- Product Name - Name of the Product
- Price - Price of the Product
- Optional parameters (Product Compared Item):
- Brand - Brand Name of the Travel Product
- Product Discount - Discount applied for the Travel booking
- Tier - Class of Travel
// Adding the product to the Product List productList.add(product); // ProductCompared Constructor Call ProductCompared productCompared = new ProductCompared(userId, productList);
- Mandatory parameters (Product Compared):
- User Id - Unique User Identifier
- Product List - Array of the list of products initiated for Checkout
- Optional parameters (Product Compared):
- Category - Category of the Travel
- Page Name - Page that triggered the Event
- Location - Geolocation of the Event
Sample Code
// Example Longitude & Latitude code (Long / Lat is optional) LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); // Product List Array Definition List productList = new ArrayList(); // Example ProductComparedItem Constructor Call with the mandatory parameters ProductComparedItem product = new ProductComparedItem(“12345”, “SIN to DEL Return Air Tickets”, 800.00); // Examples for other parameters passed for the ProductComparedItem Class (These are optional) product.setBrand(“Singapore Airlines”) .setProductDiscount(5.00) .setTier(“Economy”); // Adding the product to the Product List productList.add(product); // Example ProductCompared Constructor Call with the mandatory parameters ProductCompared productCompared = new ProductCompared(“123”, productList); // Examples for other parameters passed for the ProductCompared Class (These are optional) productCompared.setCategory(“Flights”) .setPageName(“Compare flights”) .setLocation(location.getLatitude(), location.getLongitude()); // trackProductCompared method call MTractionEventTracker.trackProductCompared(this.getApplicationContext(), productCompared);