       payload["ip"] = ip
     }
     if let idfa = IDFA.shared.identifier {
-      payload["user_id"] = ["type": "idfa", "id": idfa]
+      payload["user"] = ["type": "idfa", "id": idfa]
     }
     
     guard
       let data = try? JSONSerialization.data(withJSONObject: payload, options: .prettyPrinted),
       let body = String(data: data, encoding: .utf8)
     else { return }
-    events.removeAll()
+    
     print(body)
+
+    guard let key = AdsManager.apiKey else { return }
+    let secretString = ["A^HJ))jYpL", ")*&NnVvT#s"].sample()
+    let secretNumber = ["44357", "84437", "99989"].sample()
+    let message = key.substring(with: 1..<9) + secretNumber
+    let bytes = Array(message.utf8)
+    
+    let hmac = try! HMAC(key: secretString, variant: .sha256).authenticate(bytes).toBase64()!
+
+    let url = URL(string: "http://192.168.7.55:9999/v1/app")!
+    var request = URLRequest(url: url)
+    request.httpMethod = "POST"
+    request.httpBody = data
+    request.addValue("application/json", forHTTPHeaderField: "Content-Type")
+    request.addValue(key, forHTTPHeaderField: "X-SDK-Key")
+    request.addValue(hmac, forHTTPHeaderField: "X-SDK-Auth")
+
+    let task = URLSession.shared.dataTask(with: request) {
+      guard
+        let response = $1 as? HTTPURLResponse, response.statusCode == 200,
+        let _ = $0, $2 == nil
+      else { return }
+      self.events.removeAll()
+    }
+    task.resume()
   }
   var sharedPayload: [String: Any] = [
     "sdk_version": Bundle.init(for: AdsManager.self).infoDictionary?["CFBundleShortVersionString"] as? String ?? "",

    return ASIdentifierManager.shared().advertisingIdentifier.uuidString
  }
}

        let minDuration: String = nonlinear.element?.value(ofAttribute: "minSuggestedDuration")
      else { return }
      eventPayload["ad_format"] = "\(placement)_nonlinear_\(hPos == "center" ? "banner" : "corner")"
      eventPayload["creative_url"] = [resourceURL]
      eventPayload["ad_ts"] = minDuration.toTimeInterval
      vast.nonlinear.track(event: event)
    }
