toJson method

Map<String, Object> toJson()

Implementation

Map<String, Object> toJson() {
  Map<String, Object> result;

  result = {
    "vaid": modification?.variationId ?? "",
    "caid": modification?.variationGroupId ?? "",
    "vid": visitorId,
    "cid": envId
  };

  if (this.anonymousId != null) {
    result.addEntries({"aid": anonymousId ?? ""}.entries);
  }

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