Activate.fromMap constructor

Activate.fromMap(
  1. String oldId,
  2. Map body
)

Implementation

Activate.fromMap(String oldId, Map body) {
  // Set the type
  this.type = HitCategory.ACTIVATION;
  // Set the visitor
  super.visitorId = body["vid"] ?? "";
  // Set the aid if exist
  if (body["aid"] != null) {
    this.anonymousId = body["aid"];
  }
  // Set the old id
  this.id = oldId;
  // Set the client Id
  this.envId = body["cid"] ?? "";

  try {
    // Set the createdAt
    this.createdAt = DateTime.parse(body['createdAt']);
  } catch (e) {
    Flagship.logger(Level.EXCEPTIONS, e.toString());
    this.createdAt = DateTime.now();
  }

  // Create the modification object to set the "caid" & "vaid"
  if ((body["caid"] != null) && (body["vaid"] != null)) {
    modification = Modification("", "", "", body["caid"], "", body["vaid"],
        "", false, "campaignType", "slug", null);
  }
}