Skip to content

Instantly share code, notes, and snippets.

@Wizpna
Last active November 19, 2023 18:45
Show Gist options
  • Save Wizpna/86be5b9efc8e564b3c92f5bd352797b9 to your computer and use it in GitHub Desktop.
Save Wizpna/86be5b9efc8e564b3c92f5bd352797b9 to your computer and use it in GitHub Desktop.
A demonstration project illustrating how to implement appflyer in your Flutter project.
//this function log events to AppFlyer
Future<void> logAppFlyerEvent(String eventName, Map eventValues) async {
AppsflyerSdk appsflyerSdk = AppsflyerSdk(
AppsFlyerOptions(
//afDevKey is AppsFlyer Dev key and it's a required parameter
afDevKey: "3gnv2x6xnTA5sSXfoMEtcH",
//Your apple Id is required for iOS apps and it's a required parameter
//To access your Apple ID visit : https://appstoreconnect.apple.com/apps
// Click on your app. Create new app if you don't have one.
// Then click on App Information at the left side which will open a new window where you will find Apple ID
appId: "1234567890",
showDebug: kDebugMode,
timeToWaitForATTUserAuthorization: 50,
disableAdvertisingIdentifier: false,
disableCollectASA: false,
),
);
try {
await appsflyerSdk.logEvent(eventName, eventValues).then((value) {
});
} catch (e) {
if (kDebugMode) {
print(e.toString());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment