track method

Checks consent, once it has been read, and queues event.

Never records anything a pipeline that could not start was asked to: the event is dropped and the result says why.

Implementation

Future<DVTrackResult> track(DVAnalyticsEvent event) async {
  final DVAnalytics analytics;
  try {
    analytics = await pipeline;
  } on Object catch (error) {
    return DVTrackResult.refused(reason: 'analytics could not start: $error');
  }
  return analytics.track(event);
}