appsflyer_sdk 1.0.0
appsflyer_sdk: ^1.0.0 copied to clipboard
A new flutter plugin project.
appsflyer_sdk #
A new 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.
Table of content #
Supported Platforms #
- Android
- iOS 8+
This plugin is built for #
- iOS AppsFlyerSDK v4.8.10
- Android AppsFlyerSDK v4.8.18
## API Methods
static Future<dynamic> initSdk(Map options) async
initialize the SDK.
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';
//..
try {
dynamic options = {
"afDevKey": afDevKey,
"appId": appId, "isDebug": true};
result = await AppsflyerSdk.initSdk(options);
} 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"
}
}