addTrackingElementsToBatch method

dynamic addTrackingElementsToBatch(
  1. List<Hit> listOfTracking
)

Implementation

addTrackingElementsToBatch(List<Hit> listOfTracking) {
  // Retreive the track elements
  List<Hit> cachedHits = listOfTracking
      .where((element) => element.type != HitCategory.ACTIVATION)
      .toList();
  if (cachedHits.isNotEmpty) {
    // Create and send the hits in  batch
    sendBatch(cachedHits);
  }

  // Retreive the activate elements
  List<Hit> activateddHits = listOfTracking
      .where((element) => element.type == HitCategory.ACTIVATION)
      .toList();
  if (activateddHits.isNotEmpty) {
    // Create and send the activate in batch
    sendActivateBatch(activateddHits);
  }
}