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:

  1. If cost_cents_USD is present, it is used directly.
  2. Otherwise, af_cost_value combined with af_cost_currency is used.
  3. Either way, a supported af_cost_model is required: cpi, cpc, cpm or cpa. Without one of these four values, the cost data is ignored.
  4. 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 setAppsFlyerCostData is called.
  • Calling it again replaces the previously reported cost data. A call with a map that fails validation (missing/unsupported af_cost_model, and no cost_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.

Related articles

PurchaserService

IPopupBase

SubscriptionService

Introduction

MagifyManager․Lto

MagifyPresenter