A Flutter plugin for AppsFlyer SDK.
🛠 In order for us to provide optimal support, we would kindly ask you to submit any issues to support@appsflyer.com
When submitting an issue please specify your AppsFlyer sign-up (account) email , your app ID , reproduction steps, logs, code snippets and any additional relevant information.
- v6 Breaking changes
- Getting started
- Setting AppsFlyer options
- Initializing the SDK
- Set plugin for IOS 14
- Additional Guides
- APIs
- Android
- iOS 8+
-
iOS AppsFlyerSDK v6.4.0
-
Android AppsFlyerSDK v6.4.0
- UDL (Unified deep link) now as a dedicated class with getters for handling the deeplink result. Check the full UDL guide.
setSharingFilter
&setSharingFilterForAllPartners
APIs are deprecated. Instead use the new APIsetSharingFilterForPartners
.
- Remove stream from the plugin (no change is needed if you use callbacks for handling deeplink).
In v6 of AppsFlyer SDK there are some api breaking changes:
Before v6 | v6 |
---|---|
trackEvent | logEvent |
stopTracking | stop |
validateAndTrackInAppPurchase | validateAndLogInAppPurchase |
Before v6.1.2+4 | v6.1.2+4 |
---|---|
validateAndTrackInAppPurchase | validateAndTrackInAppIosPurchase/validateAndTrackInAppAndroidPurchase |
- Switch
ConversionData
andOnAppOpenAttribution
to be based on callbacks instead of streams since plugin version6.0.5+2
In order to install the plugin, visit this page.
To start using AppsFlyer you first need to create an instance of AppsflyerSdk
before using any other of our sdk functionalities.
AppsflyerSdk
receives a map or AppsFlyerOptions
object. This is how you can configure our AppsflyerSdk
instance and connect it to your AppsFlyer account.
Example (using map):
import 'package:appsflyer_sdk/appsflyer_sdk.dart';
//..
Map appsFlyerOptions = { "afDevKey": afDevKey,
"afAppId": appId,
"isDebug": true};
AppsflyerSdk appsflyerSdk = AppsflyerSdk(appsFlyerOptions);
Disable Advertiser ID & IDFA:
Adding "disableAdvertisingIdentifier": true
in the appsFlyerOptions will disable:
Android:
OAID (Open Anonymous Device Identifier)
AAID (Amazon Advertising ID)
GAID (Google Advertising ID)
iOS:
IDFA
Map appsFlyerOptions = {
"afDevKey": afDevKey,
"afAppId": appId,
"isDebug": true
"disableAdvertisingIdentifier": true
};
The next step is to call initSdk
which have the optional boolean parameters
registerConversionDataCallback
,
registerOnAppOpenAttributionCallback
and
registerOnDeepLinkingCallback
which are set to true as default.
After we call initSdk
we can use all of AppsFlyer SDK features.
Initialize the SDK to enable AppsFlyer to detect installations, sessions (app opens) ,updates and use all of our features.
appsflyerSdk.initSdk(
registerConversionDataCallback: true,
registerOnAppOpenAttributionCallback: true,
registerOnDeepLinkingCallback: true
);
-
Add
#import <AppTrackingTransparency/AppTrackingTransparency.h>
in yourAppDelegate.m
-
Add the ATT pop-up for IDFA collection so your
AppDelegate.m
will look like this:
-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
[GeneratedPluginRegistrant registerWithRegistry:self];
if (@available(iOS 14, *)) {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
//If you want to do something with the pop-up
}];
}
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
-
Add Privacy - Tracking Usage Description inside your
.plist
file in Xcode. -
Optional: Set the
timeToWaitForATTUserAuthorization
property in theAppsFlyerOptions
to delay the sdk initazliation for a number ofx seconds
until the user accept the consent dialog:
AppsFlyerOptions options = AppsFlyerOptions(
afDevKey: DotEnv().env["DEV_KEY"],
appId: DotEnv().env["APP_ID"],
showDebug: true,
timeToWaitForATTUserAuthorization: 30
);
For more info visit our Full Support guide for iOS 14:
Great installation and setup guides can be viewed here
see the full API available for this plugin.