Flutter SDK Attribution

The Flutter SDK lets you report the attribution signals your app collects from marketing partners and Mobile Measurement Partners (MMPs), so they are attached to the client and sent along with analytics events. All members below require init to have completed and, being part of client state, are write-only unless a getter is listed.

Media source

MediaSource carries the network, campaign and ad group that acquired the user:

MediaSource({String? network, String? campaign, String? adGroup});
await MagifyClient.instance.setMediaSource(
  const MediaSource(
    network: 'facebook',
    campaign: 'summer_promo',
    adGroup: 'lookalike_1',
  ),
);

Adjust ID

await MagifyClient.instance.setAdjustId(adjustDeviceId);

Firebase instance ID

await MagifyClient.instance.setFirebaseInstanceId(firebaseInstanceId);

Referrer

await MagifyClient.instance.setReferrerId(deepLinkReferrer);

MagifyClient.instance.referrerIdChanges.listen((_) async {
  final referrerId = await MagifyClient.instance.referrerId;
  debugPrint('Referrer id: $referrerId');
});

Client identity

All of the attribution fields above are associated with the SDK's own client identifier:

Future<String> get clientId returns the identifier the SDK uses with the Magify backend. It is derived from MagifyConfig.clientId when you supply one (a stable UUID v5 derived from that value), or generated as a random UUID by the Android SDK when you don't.

Integrating with your MMP

Setting these fields is only half of attribution — you still need to wire the Flutter SDK to whichever attribution SDK your app uses to obtain them (AppsFlyer, Adjust, and so on). See the per-integration guides for the concrete wiring:

Next step

Continue to Conversion tracking to report acquisition cost data from Adjust or AppsFlyer.

Related articles

Purchases

MagifyManager․Lto

Analytics

Android SDK Releases

ContentItem

ProductIdType