appsflyer-flutter-plugin
appsflyer-flutter-plugin copied to clipboard
How to use this plugin in combination with segment
Hello together,
we are currently using Segment with the following plugin https://pub.dev/packages/flutter_segment and would like to integrate AppsFlyer, but we don't know how. Is there any getting started etc. for that use case? How is that possible?
Thank you so much for your response!
Best regards,
Niklas
Here's how I solved this:
- I installed both SDK's Appflyer's and Segment's
- I only use Segment to track events
- On my app initialization I do:
final appsflyer_id = await appsFlyerSdk.getAppsFlyerUID();
SegmentDefaultOptions.instance.options = {
'integrations': {
'AppsFlyer': {'appsFlyerId': appsflyer_id},
}
};
I also setup my callback this way:
appsFlyerSdk.onInstallConversionData((res) async {
Map<String, dynamic> payload = res['payload'];
payload['appsflyer_id'] = appsflyer_id;
unawaited(tracking.updateParameters(payload));
await Segment.setContext({'campaign': payload});
});
tracking is a sharedPrefs object that stores attribution data, so I can send it to other calls (or even directly to my db) if I want to.
@brunapcat
To send information related to the campaign, do you have to configure something else in the segment destinations? For example, it sent the campaign information to the segment context but that information is not registered in appsflyer
Don't know if I understood your question but you could manually add this info to context like I did, I set my
await Segment.setContext({'campaign': payload});
every time my onInstallConversionData callback is called. If you just want to add this info somewhere else I'd suggest storing it on SharedPrefs through out your code.