logViewItem method
Future<void>
logViewItem({
- @required String itemId,
- @required String itemName,
- @required String itemCategory,
- String itemLocationId,
- double price,
- int quantity,
- String currency,
- double value,
- String flightNumber,
- int numberOfPassengers,
- int numberOfNights,
- int numberOfRooms,
- String origin,
- String destination,
- String startDate,
- String endDate,
- String searchTerm,
- String travelClass,
Logs the standard view_item
event.
This event signifies that some content was shown to the user. This
content may be a product, a webpage or just a simple image or text. Use
the appropriate parameters to contextualize the event. Use this event to
discover the most popular items viewed in your app. 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> logViewItem({
@required String itemId,
@required String itemName,
@required String itemCategory,
String itemLocationId,
double price,
int quantity,
String currency,
double value,
String flightNumber,
int numberOfPassengers,
int numberOfNights,
int numberOfRooms,
String origin,
String destination,
String startDate,
String endDate,
String searchTerm,
String travelClass,
}) {
_requireValueAndCurrencyTogether(value, currency);
return logEvent(
name: 'view_item',
parameters: filterOutNulls(<String, dynamic>{
_ITEM_ID: itemId,
_ITEM_NAME: itemName,
_ITEM_CATEGORY: itemCategory,
_ITEM_LOCATION_ID: itemLocationId,
_PRICE: price,
_QUANTITY: quantity,
_CURRENCY: currency,
_VALUE: value,
_FLIGHT_NUMBER: flightNumber,
_NUMBER_OF_PASSENGERS: numberOfPassengers,
_NUMBER_OF_NIGHTS: numberOfNights,
_NUMBER_OF_ROOMS: numberOfRooms,
_ORIGIN: origin,
_DESTINATION: destination,
_START_DATE: startDate,
_END_DATE: endDate,
_SEARCH_TERM: searchTerm,
_TRAVEL_CLASS: travelClass,
}),
);
}