PhoneGap AppsFlyer plugin for Android and iOS.
Built against Phonegap >= 3.3.x.
Add the following line to your config xml:
<gap:plugin name="com.appsflyer.phonegap.plugins.appsflyer" version="1.0.1" />
Add following lines to your code to be able to initialize tracking with your own AppsFlyer dev key:
Installation using CLI:
$ cordova plugin add https://github.com/AppsFlyerSDK/PhoneGap.git
phonegap.js. Mind the path:
1. Add the following xml to your
config.xml in the root directory of your
<!-- for iOS -->
<!-- for Android -->
2. For Android, add the following xml to your
3. Copy appsflyer.js to
www/js/plugins and reference it in
4. Download the source files and copy them to your project.
platforms/android/src/com/appsflyer/cordova/plugins (create the folders)
1. Set your App_ID (iOS only), Dev_Key and enable AppsFlyer to detect installations, sessions (app opens), and updates.
**Note: ** *This is the minimum requirement to start tracking your app installs and it's 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.
2. Set currency code (optional)
//USD is default value. Acceptable ISO() Currency codes here. Examples://British Pound: window.plugins.appsFlyer.setCurrencyCode("GBP");windowpluginsappsFlyer;
3. Set customer user ID (Advance)
Setting your own custom ID will enable you to cross-reference your own unique ID with AppsFlyer’s user ID and the
other devices’ IDs. This ID will be available at AppsFlyer CSV reports along with postbacks APIs for cross-referencing
with you internal IDs.
Note: The ID must be set during the first launch of the app at the SDK initialization. The best practice is to call to this API during
deviceready event if possible.
4. In App Events Tracking API (optional)
These events help you track how loyal users discover your app and attribute them to specific campaign/source.
- 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 would like 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.
// eventName - any string to define the event name. For example: “registration” or “purchase”// eventValue - the sales value. For example: 0.99 or 0.79windowpluginsappsFlyer;// window.plugins.appsFlyer.sendTrackingWithEvent(eventName, "");
5. Get AppsFlyer’s Unique Device UID (Advanced)
Get AppsFlyer’s proprietary device ID. AppsFlyer device ID is the main ID used by AppsFlyer in the Reports and API’s.
// getUserIdCallbackFn - callback functionwindowpluginsappsFlyer;
6. Accessing AppsFlyer Attribution / Conversion Data from the SDK (Deferred