logEcommercePurchase method

Future<void> logEcommercePurchase({
  1. String currency,
  2. double value,
  3. String transactionId,
  4. double tax,
  5. double shipping,
  6. String coupon,
  7. String location,
  8. int numberOfNights,
  9. int numberOfRooms,
  10. int numberOfPassengers,
  11. String origin,
  12. String destination,
  13. String startDate,
  14. String endDate,
  15. String travelClass,
})

Logs the standard ecommerce_purchase event.

This event signifies that an item was purchased by a user. Note: This is different from the in-app purchase event, which is reported automatically for Google Play-based apps. Note: If you supply the value parameter, you must also supply the currency parameter so that revenue metrics can be computed accurately.

See: https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event.html#ECOMMERCE_PURCHASE

Implementation

Future<void> logEcommercePurchase({
  String currency,
  double value,
  String transactionId,
  double tax,
  double shipping,
  String coupon,
  String location,
  int numberOfNights,
  int numberOfRooms,
  int numberOfPassengers,
  String origin,
  String destination,
  String startDate,
  String endDate,
  String travelClass,
}) {
  _requireValueAndCurrencyTogether(value, currency);

  return logEvent(
    name: 'ecommerce_purchase',
    parameters: filterOutNulls(<String, dynamic>{
      _CURRENCY: currency,
      _VALUE: value,
      _TRANSACTION_ID: transactionId,
      _TAX: tax,
      _SHIPPING: shipping,
      _COUPON: coupon,
      _LOCATION: location,
      _NUMBER_OF_NIGHTS: numberOfNights,
      _NUMBER_OF_ROOMS: numberOfRooms,
      _NUMBER_OF_PASSENGERS: numberOfPassengers,
      _ORIGIN: origin,
      _DESTINATION: destination,
      _START_DATE: startDate,
      _END_DATE: endDate,
      _TRAVEL_CLASS: travelClass,
    }),
  );
}