AppsFlyer
The Magify Flutter SDK does not depend on the AppsFlyer SDK. If your app already integrates
appsflyer_sdk for attribution, forward its
acquisition-cost data to Magify with a single call.
setAppsFlyerCostData
Future<void> setAppsFlyerCostData(Map<String, Object> conversionInfo)
Call it with the conversion-data payload as AppsFlyer delivers it — do not reshape it first. The SDK reads the map as follows:
- If
cost_cents_USDis present, it is used directly. - Otherwise,
af_cost_valuecombined withaf_cost_currencyis used. - Either way, a supported
af_cost_modelis required:cpi,cpc,cpmorcpa. Without one of these four values, the cost data is ignored. - Any other key in the map is ignored.
Wiring it up
Feed the payload from AppsFlyer's conversion-data callback straight into
setAppsFlyerCostData, after MagifyClient.instance.init has completed:
import 'package:appsflyer_sdk/appsflyer_sdk.dart';
import 'package:magify_flutter_sdk/magify_sdk.dart';
void onConversionDataSuccess(Map<dynamic, dynamic> data) {
final conversionInfo = Map<String, Object>.from(data);
MagifyClient.instance.setAppsFlyerCostData(conversionInfo);
}
// When wiring up the AppsFlyer SDK:
appsflyerSdk.onInstallConversionData(onConversionDataSuccess);
Notes
- This is a one-way call — there is no getter to read back what was reported.
- It does not block Magify's own startup: the first context request to the Magify backend
goes out without cost data if AppsFlyer hasn't resolved it yet, and the config is reloaded
once
setAppsFlyerCostDatais called. - Calling it again replaces the previously reported cost data. A call with a map that fails
validation (missing/unsupported
af_cost_model, and nocost_cents_USD) leaves the previous value untouched.
Next step
See Adjust if you also integrate Adjust, or Your own integration for the general pattern this call follows.