Skip to content

Latest commit

 

History

History
119 lines (84 loc) · 3.17 KB

api.md

File metadata and controls

119 lines (84 loc) · 3.17 KB

await new AppsFlyerSDK(Object config)

Initalization of the SDK

Setting Description
devKey Your application devKey provided by AppsFlyer (required)
appId App ID you configured in your AppsFlyer dashboard (required)
isDebug Show Debug logs - set to true for testing only!
isSandbox Send events to sandbox endpoints - set to true for testing only!
let appsflyer;
let config = {
   devKey: "RxutGo4bSB9MKkM7bMCjHP",
   appId: "3202204027284",
   isDebug: true, 
   isSandbox: false
};

try{  
   appsflyer = await new AppsFlyerSDK(config);
}catch(e){
   console.log(e);
}  

start()

Send session to our servers

try{
   let response = await appsflyer.start();
   console.log("start API response success: " + JSON.stringify(response));
}catch(err){
   console.log("start API response err: " + JSON.stringify(err));
}

logEvent(String eventName, Object eventValues)

parameter type description
eventName String The event name, it is presented in your dashboard.
eventValues Object The event values that are sent with the event.

Send in-app event

   try{
       let response = await appsflyer.logEvent("af_purchase", {"af_revenue" : 1.99, "af_currency": "USD"})
       console.log("logEvent API response success: " + JSON.stringify(response));
   }catch(err){
       console.log("logEvent API response err: " + JSON.stringify(err));
   }

setCustomPayload(Object customPayload)

Add custom payload. You could use it to integrate other platforms

   let customPayload = {
       "device_model": "3920X",
       "device_os_version": "9.3.0",
       "app_version": "1.0.5",
       "device_id": "fa73d67d-f55c-5af3-883a-726253dc7d0e",
   }

   appsflyer.setCustomPayload(customPayload);

setCustomerUserId(string customerUserId)

Add customer user id. This will add customer_user_id key to the payload.

   appsflyer.setCustomerUserId("123");

init(Object config)

Please use await new AppsFlyerSDK(config) instead.

let config = {
   devKey: "RxutGo4bSB9MKkM7bMCjHP",
   appId: "3202204027284",
   isDebug: true, 
   isSandbox: false
}

try{  
   await appsflyer.init(config);
}catch(e){
   console.log(e);
}