iOS SDKLess + Sample App which demonstrates the usage of Appsflyer API - SKAdNetwork S2S get conversion value per user
The repository has 2 parts:
- The AppsFlyerSDKLessSKAdNetworkClient - SDKLess code (Obj-C)
- The Sample App (Obj-C + Swift)
Call the SK API with GET request that has the following query params:
Key | Description |
---|---|
uid |
appsflyer id |
app_id |
application id |
af_timestamp |
current time in miliseconds |
af_sig |
Create an HMAC SHA256 signature by concatenating the values of the timestamp, dev key, app id, and AppsFlyer id: HmacSHA256(af_timestamp + DevKey + app_id + uid) |
app_id in a format - "idxxxxxxx"
The HMAC is generated using SHA256 and uses the DevKey as the signature’s secret key. The account Dev Key is taken from the App Settings page in the AppsFlyer dashboard.
https://skadsdkless.appsflyer.com/api/v1.0/conversion-value?uid=LYPnL-sdJuSwjg-AQ2GTZehc&app_id=123456789&af_sig=b457aca5d23a6cbe512775578201&af_timestamp=1603034622
SK API will return the following conversion value response as JSON:
{
"value": 43
}
Code | Description |
---|---|
200 | the conversion value |
400 | invalid request (params or headers missing or malformed) |
401 | invalid signature |
404 | uid not found/expired |
503 | server busy |
(Be sure you run Xcode 12+)
$ cd Example
$ pod install
- AppsFlyerSDKLessSKAdNetworkClient
- OCMock - for testing
- OHHTTPStubs - for testing
private let uid = "YOUR_APPSFLYER_ID"; //AppsFlyerLib.shared().getAppsFlyerUID()
private let appId = "YOUR_APP_ID"; //ID - is a string with following format @"idXXXXXXXX"
private let devKey = "YOUR_DEV_KEY";
AFSDKLessClient.shared.requestConversionValue(withUID: self.uid, devKey: self.devKey, appID: self.appId) { (cv, error) in
if let cv = cv?.intValue {
// Tells to the Client to register For AdNetwork Attribution (iOS 11.3+)
// Should be called only once
AFSDKLessClient.shared.registerForAdNetworkAttribution()
// Tells to the Client to update conversion value
AFSDKLessClient.shared.updateConversionValue(cv)
task.setTaskCompleted(success: true)
} else {
task.setTaskCompleted(success: false)
}
}