🛠 In order for us to provide optimal support, we would kindly ask you to submit any issues to support@appsflyer.com
Set your App_ID (iOS only), Dev_Key and enable AppsFlyer to detect installations, sessions (app opens) and updates.
This is the minimum requirement to start tracking your app installs and is already implemented in this plugin. You MUST modify this call and provide:
devKey - Your application devKey provided by AppsFlyer.
appId - For iOS only. Your iTunes Application ID.
waitForATTUserAuthorization - For iOS14 only. Time for the sdk to wait before launch.
Add the following lines to your code to be able to initialize tracking with your own AppsFlyer dev key:
document.addEventListener('deviceready', function() {
window.plugins.appsFlyer.initSdk({
devKey: 'K2***************99',
isDebug: false,
appId: '41*****44',
waitForATTUserAuthorization: 10,
},
(result) => {
console.log(result);
},
(error) => {
console.error(error);
}
);
}, false);
In case you are using Ionic framework, you have 2 options:
1 - Using Ionic native plugin
Ionic 4
run this commands:
With Cordova:
$ ionic cordova plugin add cordova-plugin-appsflyer-sdk
$ npm install @ionic-native/appsflyer
With Capacitor:
$ npm install cordova-plugin-appsflyer-sdk
$ npm install @ionic-native/appsflyer
ionic cap sync
Then add the following to app.module.ts
import { Appsflyer } from "@ionic-native/appsflyer/ngx";
...
providers: [
Appsflyer,
...,
]
and in your main ts file:
import { Appsflyer } from '@ionic-native/appsflyer/ngx';
import {Platform} from '@ionic/angular';
constructor(private appsflyer: Appsflyer, public platform: Platform) {
...
this.platform.ready().then(() => {
this.appsflyer.initSdk(options);
});
}
Ionic 2/3
If you're using Ionic 2/3, you'd need to install a previous version of the Ionic Native dependency (notice the @4 at the end of the npm install command):
$ ionic cordova plugin add cordova-plugin-appsflyer-sdk
$ npm install @ionic-native/appsflyer@4
Then add the following to app.module.ts
(with no /ngx)
import { Appsflyer } from "@ionic-native/appsflyer";
...
providers: [
Appsflyer,
...,
]
And finally in your main ts file:
import { Appsflyer } from '@ionic-native/appsflyer';
2. Using the window
object directly