sendEvent method

  1. @override
Future<void> sendEvent(
  1. String category,
  2. String action, {
  3. String? label,
  4. int? value,
  5. Map<String, String>? parameters,
})
inherited

Sends an Event hit to Google Analytics. label specifies the event label. value specifies the event value. Values must be non-negative.

parameters can be any analytics key/value pair. Useful for custom dimensions, etc.

Implementation

@override
Future<void> sendEvent(String category, String action,
    {String? label, int? value, Map<String, String>? parameters}) {
  final args = <String, String>{
    'ec': category,
    'ea': action,
    if (label != null) 'el': label,
    if (value != null) 'ev': value.toString(),
    ...?parameters
  };

  return _enqueuePayload('event', args);
}