In order for us to provide optimal support, we would kindly ask you to submit any issues to support@appsflyer.com
1. Add the following xml to your config.xml
in the root directory of your www
folder:
<feature name="AppsFlyerPlugin">
<param name="ios-package" value="AppsFlyerPlugin" />
</feature>
<feature name="AppsFlyerPlugin">
<param name="android-package" value="com.appsflyer.cordova.plugin.AppsFlyerPlugin" />
</feature>
2. For Android, add the following xml to your AndroidManifest.xml
:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Inside the <aplication>
tag, add the following receiver:
<receiver android:exported="true" android:name="com.appsflyer.MultipleInstallBroadcastReceiver">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
3. Copy appsflyer.js to www/js/plugins
and reference it in index.html
:
<script type="text/javascript" src="js/plugins/appsflyer.js"></script>
4. Download the source files and copy them to your project.
Add the following lines to your code to be able to track deeplinks with AppsFlyer attribution data:
for pure Cordova - add a function 'handleOpenUrl' to your root, and call our SDK as shown:
window.plugins.appsFlyer.handleOpenUrl(url);
It appears as follows:
var handleOpenURL = function(url) {
window.plugins.appsFlyer.handleOpenUrl(url);
}
##Demo
This plugin has a examples
folder with demoA
(Angular 1) and demoC
(Cordova) projects bundled with it. To give it a try , clone this repo and from root a.e. cordova-plugin-appsflyer-sdk
execute the following:
For Cordova:
npm run setup_c
npm run demo_c.ra
- runs Androidnpm run demo_c.ba
- builds Androidnpm run demo_c.ri
- runs iOSnpm run demo_c.bi
- builds iOS
For Angular:
npm run setup_a
npm run demo_a.ra
- runs Androidnpm run demo_a.ba
- builds Androidnpm run demo_a.ri
- runs iOSnpm run demo_a.bi
- builds iOS