communBodyTrack property

Map<String, Object> communBodyTrack

Implementation

Map<String, Object> get communBodyTrack {
  var result = new Map<String, Object>();

  result.addAll({"cid": clientId, "ds": dataSource});

  /// Add xpc informations
  result.addEntries(_createTuple().entries);

  /// User ipx
  if (userIp != null) result["uip"] = dataSource;

  /// ScreenResolution
  if (screenResolution != null) result["sr"] = screenResolution ?? "";

  /// User language
  if (userLanguage != null) result["ul"] = userLanguage ?? "";

  /// Session number
  if (sessionNumber != null) result["sn"] = sessionNumber ?? 0;

  /// Add qt entries
  /// Time difference between when the hit was created and when it was sent
  if (this.createdAt != null) {
    result.addEntries({
      "qt": DateTime.now()
          .difference(createdAt ?? DateTime.now())
          .inMilliseconds
    }.entries);
  }
  return result;
}