logAddToCart method
Logs the standard add_to_cart
event.
This event signifies that an item was added to a cart for purchase. Add
this event to a funnel with logEcommercePurchase to gauge the
effectiveness of your checkout process. 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> logAddToCart({
required String itemId,
required String itemName,
required String itemCategory,
required int quantity,
double? price,
double? value,
String? currency,
String? origin,
String? itemLocationId,
String? destination,
String? startDate,
String? endDate,
}) {
_requireValueAndCurrencyTogether(value, currency);
return logEvent(
name: 'add_to_cart',
parameters: filterOutNulls(<String, Object?>{
_ITEM_ID: itemId,
_ITEM_NAME: itemName,
_ITEM_CATEGORY: itemCategory,
_QUANTITY: quantity,
_PRICE: price,
_VALUE: value,
_CURRENCY: currency,
_ORIGIN: origin,
_ITEM_LOCATION_ID: itemLocationId,
_DESTINATION: destination,
_START_DATE: startDate,
_END_DATE: endDate,
}),
);
}