appsflyer_sdk 1.0.5
appsflyer_sdk: ^1.0.5 copied to clipboard
A Flutter plugin for AppsFlyer SDK. Supports iOS and Android.
appsflyer_sdk #
A Flutter plugin for AppsFlyer SDK.
Getting Started #
For help getting started with Flutter, view our online documentation.
For help on editing plugin code, view the documentation.
Supported Platforms #
- Android
- iOS 8+
This plugin is built for #
- iOS AppsFlyerSDK v4.8.10
- Android AppsFlyerSDK v4.8.18
## API Methods
AppsflyerSdk(Map options)
parameter | type | description |
---|---|---|
options |
Map |
SDK configuration |
options
name | type | default | description |
---|---|---|---|
afDevKey |
string |
Appsflyer Dev key | |
appId |
string |
Apple Application ID (for iOS only) | |
isDebug |
boolean |
false |
debug mode (optional) |
Example:
import 'package:appsflyer_sdk/appsflyer_sdk.dart';
//..
Map options = { "afDevKey": afDevKey,
"appId": appId,
"isDebug": true};
AppsflyerSdk appsflyerSdk = AppsflyerSdk(appsFlyerOptions);
static Future<dynamic> initSdk() async
initialize the SDK, using the options initialized from the constructor|
Example:
import 'package:appsflyer_sdk/appsflyer_sdk.dart';
//..
AppsflyerSdk appsflyerSdk = AppsflyerSdk({...});
try {
result = await appsflyerSdk.initSdk();
} on Exception catch (e) {
print("error: " + e.toString());
return;
}
static Future<bool> trackEvent(String eventName, Map eventValues) async
(optional)
- These in-app events help you track how loyal users discover your app, and attribute them to specific campaigns/media-sources. Please take the time define the event/s you want to measure to allow you to track ROI (Return on Investment) and LTV (Lifetime Value).
- The
trackEvent
method allows you to send in-app events to AppsFlyer analytics. This method allows you to add events dynamically by adding them directly to the application code.
parameter | type | description |
---|---|---|
eventName |
String |
custom event name, is presented in your dashboard. See the Event list HERE |
eventValues |
Map |
event details |
Example:
Future<bool> sendEvent(String eventName, Map eventValues) async {
bool result;
try {
result = await appsflyerSdk.trackEvent(eventName, eventValues);
} on Exception catch (e) {}
print("Result trackEvent: ${result}");
}
Conversion Data and on app open attribution
Returns Stream
. Accessing AppsFlyer Attribution / Conversion Data from the SDK (Deferred Deeplinking). Read more: Android, iOS. AppsFlyer plugin will return attribution data as JSON Map
in Stream
.
static Stream<dynamic> registerConversionDataCallback()
Example:
appsflyerSdk.registerConversionDataCallback().listen((data) {
//print("GCD: " + data.toString());
//....
}).onError((handleError) {
print("error");
});
Example of success Organic response:
{
"status": "success",
"type": "onInstallConversionDataLoaded",
"data": {
"af_status": "Organic",
"af_message": "organic install",
"is_first_launch": "false"
}
}
Example of failure response:
{
"status": "failure",
"type": "onInstallConversionDataLoaded",
"data": "SOME_ERROR_MESSAGE"
}
static Stream<dynamic> registerOnAppOpenAttributionCallback()
Example:
appsflyerSdk.registerOnAppOpenAttributionCallback().listen((data) {
//print("OnAppOpenAttribution: " + data.toString());
//....
}).onError((handleError) {
print("error");
});
Example of response on deep-link "https://flutter.demo" :
{
"status": "success",
"type": "onAppOpenAttribution",
"data": {
"link": "https://flutter.demo"
}
}