logEcommercePurchase method
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.
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,
}),
);
}