cordova-plugin-appsflyer-sdk
Advanced tools
Comparing version 4.4.8 to 4.4.9
{ | ||
"name": "cordova-plugin-appsflyer-sdk", | ||
"version": "4.4.8", | ||
"version": "4.4.9", | ||
"description": "Cordova AppsFlyer SDK Plugin", | ||
@@ -5,0 +5,0 @@ "cordova": { |
101
README.md
@@ -33,5 +33,9 @@ <img src="https://www.appsflyer.com/wp-content/uploads/2016/11/logo-1.svg" width="200"> | ||
- [trackEvent](#trackEvent) | ||
- [setCollectIMEI](#initSdk)(Android only) | ||
- [setCollectAndroidID](#initSdk)(Android only) | ||
- [deviceTrackingDisabled](#deviceTrackingDisabled) | ||
- [setCurrencyCode](#setCurrencyCode) | ||
- [setAppUserId](#setAppUserId) | ||
- [stopTracking](#stopTracking) | ||
- [registerOnAppOpenAttribution](#registerOnAppOpenAttribution) | ||
- [enableUninstallTracking](#enableUninstallTracking) | ||
@@ -44,3 +48,3 @@ - [updateServerUninstallToken](#updateServerUninstallToken) | ||
- [trackAndOpenStore](#trackAndOpenStore) | ||
- [Deep linking Tracking](#deep-linking-tracking) | ||
- [Deep linking Tracking](#deep-linking-tracking) | ||
- [Android](#dl-android) | ||
@@ -60,4 +64,4 @@ - [iOS URL Types](#dl-ios) | ||
- iOS AppsFlyerSDK **v4.8.1** | ||
- Android AppsFlyerSDK **v4.8.10** | ||
- iOS AppsFlyerSDK **v4.8.4** | ||
- Android AppsFlyerSDK **v4.8.11** | ||
@@ -187,4 +191,6 @@ | ||
##<a id="api-methods"> API Methods | ||
--- | ||
@@ -199,3 +205,3 @@ | ||
| `options` | `Object` | SDK configuration | | ||
| `onSuccess` | `(message: string)=>void` | Success callback - called after successfull SDK initialization. (optional)| | ||
| `onSuccess` | `(message: string)=>void` | Success callback - called after successful SDK initialization. (optional)| | ||
| `onError` | `(message: string)=>void` | Error callback - called when error occurs during initialization. (optional)| | ||
@@ -218,3 +224,23 @@ | ||
var onSuccess = function(result) { | ||
//handle result | ||
//handle result | ||
/* | ||
{ | ||
"data": { | ||
"af_dp": "https://ionic.fess.onelink.me", | ||
"af_click_lookback": "7d", | ||
"install_time": "2018-07-05 08:06:50.828", | ||
"cost_cents_USD": "0", | ||
"iscache": "true", | ||
"media_source": "someMedia", | ||
"click_time": "2018-07-05 08:06:02.956", | ||
"orig_cost": "0.0", | ||
"campaign": "someC", | ||
"key": "val", | ||
"af_status": "Non-organic", | ||
"is_first_launch": "true" | ||
}, | ||
"type": "onAppOpenAttribution", | ||
"status": "success" | ||
} | ||
*/ | ||
}; | ||
@@ -307,7 +333,70 @@ | ||
``` | ||
--- | ||
##### <a id="stopTracking"> **`stopTracking(isStopTracking): void`** | ||
Setting your own Custom ID enables you to cross-reference your own unique ID with AppsFlyer’s user ID and the other devices’ IDs. This ID is available in 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 this API during the `deviceready` event, where possible. | ||
| parameter | type | description | | ||
| ----------- |-----------------------------|--------------| | ||
| `isStopTracking` | `boolean` |In some extreme cases you might want to shut down all SDK tracking due to legal and privacy compliance. This can be achieved with the isStopTracking API. Once this API is invoked, our SDK will no longer communicate with our servers and stop functioning. | | ||
*Example:* | ||
```javascript | ||
window.plugins.appsFlyer.stopTracking(true); | ||
``` | ||
In any event, the SDK can be reactivated by calling the same API, but to pass false. | ||
--- | ||
##### <a id="registerOnAppOpenAttribution"> **`registerOnAppOpenAttribution(onSuccess, onError): void`** | ||
| parameter | type | description | | ||
| ----------- |-----------------------------|--------------| | ||
| `onSuccess` | `(message: stringifed JSON)=>void` | Success callback - called after receiving data on App Open Attribution.| | ||
| `onError` | `(message: stringifed JSON)=>void` | Error callback - called when error occurs.| | ||
*Example:* | ||
```javascript | ||
window.plugins.appsFlyer.registerOnAppOpenAttribution(function | ||
onAppOpenAttributionSuccess(res){ | ||
/* | ||
{ | ||
"data": { | ||
"af_deeplink": "true", | ||
"campaign": "boo", | ||
"key": "val", | ||
"media_source": "someMedia", | ||
"install_time": "2018-07-12 13:20:19", | ||
"af_status": "Non-organic", | ||
"path": "", | ||
"scheme": "https", | ||
"host": "ionic.fess.onelink.me" | ||
}, | ||
"type": "onAppOpenAttribution", | ||
"status": "success" | ||
} | ||
*/ | ||
}, | ||
function onAppOpenAttributionError(err){ | ||
//... | ||
}); | ||
``` | ||
--- | ||
##### <a id="enableUninstallTracking"> **`enableUninstallTracking(token, onSuccess, onError): void`** | ||
@@ -321,3 +410,3 @@ | ||
| `FCM/GCM ProjectNumber` | `String` | GCM/FCM ProjectNumber | | ||
| `onSuccess` | `(message: string)=>void` | Success callback - called after successfull register uninstall. (optional)| | ||
| `onSuccess` | `(message: string)=>void` | Success callback - called after successful register uninstall. (optional)| | ||
| `onError` | `(message: string)=>void` | Error callback - called when error occurs during register uninstall. (optional)| | ||
@@ -324,0 +413,0 @@ |
@@ -6,2 +6,3 @@ # Release Notes | ||
Release date: May 10 2018 | ||
Release type: Major / Minor / **Hotfix** | ||
@@ -18,2 +19,3 @@ | ||
Release date: May 01 2018 | ||
Release type: Major / **Minor** / Hotfix | ||
@@ -31,5 +33,7 @@ | ||
- stopTracking API | ||
### 4.4.0 | ||
@@ -36,0 +40,0 @@ * changed Android paths to support cordova-android 7.0.0 |
@@ -1,138 +0,154 @@ | ||
var exec = require('cordova/exec'), | ||
argscheck = require('cordova/argscheck'), | ||
AppsFlyerError = require('./AppsFlyerError'); | ||
var callbackMap = {}; | ||
var exec = require('cordova/exec'), | ||
argscheck = require('cordova/argscheck'), | ||
AppsFlyerError = require('./AppsFlyerError'); | ||
if (!window.CustomEvent) { | ||
window.CustomEvent = function (type, config) { | ||
var e = document.createEvent("CustomEvent"); | ||
e.initCustomEvent(type, true, true, config.detail); | ||
return e; | ||
}; | ||
var callbackMap = {}; | ||
if (!window.CustomEvent) { | ||
window.CustomEvent = function (type, config) { | ||
var e = document.createEvent("CustomEvent"); | ||
e.initCustomEvent(type, true, true, config.detail); | ||
return e; | ||
}; | ||
} | ||
(function (global) { | ||
var AppsFlyer = function () {}; | ||
AppsFlyer.prototype.initSdk = function (args, successCB, errorCB) { | ||
argscheck.checkArgs('O', 'AppsFlyer.initSdk', arguments); | ||
if (!args) { | ||
if (errorCB) { | ||
errorCB(AppsFlyerError.INVALID_ARGUMENT_ERROR); | ||
} | ||
} else { | ||
if(args.appId !== undefined && typeof args.appId != 'string'){ | ||
if (errorCB) { | ||
errorCB(AppsFlyerError.APPID_NOT_VALID); | ||
} | ||
} | ||
exec(successCB, errorCB, "AppsFlyerPlugin", "initSdk", [args]); | ||
document.addEventListener("resume", this.onResume.bind(this), false); | ||
callbackMap.convSuc = successCB; | ||
callbackMap.convErr = errorCB; | ||
} | ||
(function (global) { | ||
var AppsFlyer = function () {}; | ||
}; | ||
AppsFlyer.prototype.initSdk = function (args, successCB, errorCB) { | ||
argscheck.checkArgs('O', 'AppsFlyer.initSdk', arguments); | ||
if (!args) { | ||
if (errorCB) { | ||
errorCB(AppsFlyerError.INVALID_ARGUMENT_ERROR); | ||
} | ||
} else { | ||
if(args.appId !== undefined && typeof args.appId != 'string'){ | ||
if (errorCB) { | ||
errorCB(AppsFlyerError.APPID_NOT_VALID); | ||
} | ||
} | ||
exec(successCB, errorCB, "AppsFlyerPlugin", "initSdk", [args]); | ||
AppsFlyer.prototype.registerOnAppOpenAttribution = function (onAppOpenAttributionSuccess, onAppOpenAttributionError) { | ||
argscheck.checkArgs('FF', 'AppsFlyer.registerOnAppOpenAttribution', arguments); | ||
document.addEventListener("resume", this.onResume.bind(this), false); | ||
callbackMap.attrSuc = onAppOpenAttributionSuccess; | ||
callbackMap.attrErr = onAppOpenAttributionError; | ||
callbackMap = { | ||
suc: successCB, | ||
err: errorCB | ||
}; | ||
exec(onAppOpenAttributionSuccess, onAppOpenAttributionError, "AppsFlyerPlugin", "registerOnAppOpenAttribution", []); | ||
}; | ||
} | ||
}; | ||
AppsFlyer.prototype.onResume = function() { | ||
exec(callbackMap.suc, callbackMap.err, "AppsFlyerPlugin", "resumeSDK", []); | ||
}; | ||
AppsFlyer.prototype.setCurrencyCode = function (currencyId) { | ||
argscheck.checkArgs('S', 'AppsFlyer.setCurrencyCode', arguments); | ||
exec(null, null, "AppsFlyerPlugin", "setCurrencyCode", [currencyId]); | ||
}; | ||
AppsFlyer.prototype.onResume = function() { | ||
if(callbackMap.convSuc){ | ||
exec(callbackMap.convSuc, callbackMap.convErr, "AppsFlyerPlugin", "resumeSDK", []); | ||
} | ||
if(callbackMap.attrSuc){ | ||
exec(callbackMap.attrSuc, callbackMap.attrErr, "AppsFlyerPlugin", "registerOnAppOpenAttribution", []); | ||
} | ||
}; | ||
AppsFlyer.prototype.setAppUserId = function (customerUserId) { | ||
argscheck.checkArgs('S', 'AppsFlyer.setAppUserId', arguments); | ||
exec(null, null, "AppsFlyerPlugin", "setAppUserId", [customerUserId]); | ||
}; | ||
AppsFlyer.prototype.setGCMProjectNumber = function (gcmProjectNumber) { | ||
argscheck.checkArgs('S', 'AppsFlyer.setGCMProjectNumber', arguments); | ||
exec(null, null, "AppsFlyerPlugin", "setGCMProjectNumber", [gcmProjectNumber]); | ||
}; | ||
AppsFlyer.prototype.getAppsFlyerUID = function (successCB) { | ||
argscheck.checkArgs('F', 'AppsFlyer.getAppsFlyerUID', arguments); | ||
exec(function (result) { | ||
successCB(result); | ||
}, null, | ||
"AppsFlyerPlugin", | ||
"getAppsFlyerUID", | ||
[]); | ||
}; | ||
AppsFlyer.prototype.setCurrencyCode = function (currencyId) { | ||
argscheck.checkArgs('S', 'AppsFlyer.setCurrencyCode', arguments); | ||
exec(null, null, "AppsFlyerPlugin", "setCurrencyCode", [currencyId]); | ||
}; | ||
AppsFlyer.prototype.setDeviceTrackingDisabled = function (isDisabled) { | ||
argscheck.checkArgs('*', 'AppsFlyer.setDeviceTrackingDisabled', arguments); | ||
exec(null,null,"AppsFlyerPlugin","setDeviceTrackingDisabled", [isDisabled]); | ||
}; | ||
AppsFlyer.prototype.stopTracking = function (isStopTracking) { | ||
argscheck.checkArgs('*', 'AppsFlyer.stopTracking', arguments); | ||
exec(null,null,"AppsFlyerPlugin", "stopTracking", [isStopTracking]); | ||
}; | ||
AppsFlyer.prototype.setAppUserId = function (customerUserId) { | ||
argscheck.checkArgs('S', 'AppsFlyer.setAppUserId', arguments); | ||
exec(null, null, "AppsFlyerPlugin", "setAppUserId", [customerUserId]); | ||
}; | ||
AppsFlyer.prototype.setGCMProjectNumber = function (gcmProjectNumber) { | ||
argscheck.checkArgs('S', 'AppsFlyer.setGCMProjectNumber', arguments); | ||
exec(null, null, "AppsFlyerPlugin", "setGCMProjectNumber", [gcmProjectNumber]); | ||
}; | ||
AppsFlyer.prototype.trackEvent = function (eventName, eventValue) { | ||
argscheck.checkArgs('SO', 'AppsFlyer.trackEvent', arguments); | ||
exec(null, null, "AppsFlyerPlugin", "trackEvent", [eventName, eventValue]); | ||
}; | ||
AppsFlyer.prototype.getAppsFlyerUID = function (successCB) { | ||
argscheck.checkArgs('F', 'AppsFlyer.getAppsFlyerUID', arguments); | ||
exec(function (result) { | ||
successCB(result); | ||
}, null, | ||
"AppsFlyerPlugin", | ||
"getAppsFlyerUID", | ||
[]); | ||
}; | ||
AppsFlyer.prototype.enableUninstallTracking = function (gcmProjectNumber,successCB, errorCB) { | ||
argscheck.checkArgs('S', 'AppsFlyer.enableUninstallTracking', arguments); | ||
exec(successCB, errorCB, "AppsFlyerPlugin", "enableUninstallTracking", [gcmProjectNumber]); | ||
}; | ||
AppsFlyer.prototype.setDeviceTrackingDisabled = function (isDisabled) { | ||
argscheck.checkArgs('*', 'AppsFlyer.setDeviceTrackingDisabled', arguments); | ||
exec(null,null,"AppsFlyerPlugin","setDeviceTrackingDisabled", [isDisabled]); | ||
}; | ||
AppsFlyer.prototype.updateServerUninstallToken = function (token) { | ||
argscheck.checkArgs('S', 'AppsFlyer.updateServerUninstallToken', arguments); | ||
exec(null, null, "AppsFlyerPlugin", "updateServerUninstallToken", [token]); | ||
}; | ||
AppsFlyer.prototype.stopTracking = function (isStopTracking) { | ||
argscheck.checkArgs('*', 'AppsFlyer.stopTracking', arguments); | ||
exec(null,null,"AppsFlyerPlugin", "stopTracking", [isStopTracking]); | ||
}; | ||
// USER INVITE TRACKING | ||
AppsFlyer.prototype.setAppInviteOneLinkID = function (args) { | ||
argscheck.checkArgs('S', 'AppsFlyer.setAppInviteOneLinkID', arguments); | ||
exec(null, null, "AppsFlyerPlugin", "setAppInviteOneLinkID", [args]); | ||
}; | ||
AppsFlyer.prototype.generateInviteLink = function (args, successCB, errorCB) { | ||
argscheck.checkArgs('O', 'AppsFlyer.generateInviteLink', arguments); | ||
exec(successCB, errorCB, "AppsFlyerPlugin", "generateInviteLink", [args]); | ||
}; | ||
//CROSS PROMOTION | ||
AppsFlyer.prototype.trackCrossPromotionImpression = function (appId, campaign) { | ||
argscheck.checkArgs('*', "AppsFlyer.trackCrossPromotionImpression", arguments); | ||
exec(null, null ,"AppsFlyerPlugin","trackCrossPromotionImpression", [appId, campaign]); | ||
}; | ||
AppsFlyer.prototype.trackAndOpenStore = function (appId, campaign, params) { | ||
argscheck.checkArgs('*', "AppsFlyer.trackAndOpenStore", arguments); | ||
exec(null, null ,"AppsFlyerPlugin","trackAndOpenStore", [appId, campaign, params]); | ||
}; | ||
AppsFlyer.prototype.trackEvent = function (eventName, eventValue) { | ||
argscheck.checkArgs('SO', 'AppsFlyer.trackEvent', arguments); | ||
exec(null, null, "AppsFlyerPlugin", "trackEvent", [eventName, eventValue]); | ||
}; | ||
AppsFlyer.prototype.enableUninstallTracking = function (gcmProjectNumber,successCB, errorCB) { | ||
argscheck.checkArgs('S', 'AppsFlyer.enableUninstallTracking', arguments); | ||
exec(successCB, errorCB, "AppsFlyerPlugin", "enableUninstallTracking", [gcmProjectNumber]); | ||
}; | ||
AppsFlyer.prototype.handleOpenUrl = function (url) { | ||
argscheck.checkArgs('*', 'AppsFlyer.handleOpenUrl', arguments); | ||
exec(null, null, "AppsFlyerPlugin", "handleOpenUrl", [url]); | ||
}; | ||
AppsFlyer.prototype.updateServerUninstallToken = function (token) { | ||
argscheck.checkArgs('S', 'AppsFlyer.updateServerUninstallToken', arguments); | ||
exec(null, null, "AppsFlyerPlugin", "updateServerUninstallToken", [token]); | ||
}; | ||
// USER INVITE TRACKING | ||
AppsFlyer.prototype.setAppInviteOneLinkID = function (args) { | ||
argscheck.checkArgs('S', 'AppsFlyer.setAppInviteOneLinkID', arguments); | ||
exec(null, null, "AppsFlyerPlugin", "setAppInviteOneLinkID", [args]); | ||
}; | ||
global.cordova.addConstructor(function () { | ||
if (!global.Cordova) { | ||
global.Cordova = global.cordova; | ||
} | ||
AppsFlyer.prototype.generateInviteLink = function (args, successCB, errorCB) { | ||
argscheck.checkArgs('O', 'AppsFlyer.generateInviteLink', arguments); | ||
exec(successCB, errorCB, "AppsFlyerPlugin", "generateInviteLink", [args]); | ||
}; | ||
if (!global.plugins) { | ||
global.plugins = {}; | ||
} | ||
//CROSS PROMOTION | ||
AppsFlyer.prototype.trackCrossPromotionImpression = function (appId, campaign) { | ||
argscheck.checkArgs('*', "AppsFlyer.trackCrossPromotionImpression", arguments); | ||
exec(null, null ,"AppsFlyerPlugin","trackCrossPromotionImpression", [appId, campaign]); | ||
}; | ||
global.plugins.appsFlyer = new AppsFlyer(); | ||
}); | ||
} (window)); | ||
AppsFlyer.prototype.trackAndOpenStore = function (appId, campaign, params) { | ||
argscheck.checkArgs('*', "AppsFlyer.trackAndOpenStore", arguments); | ||
exec(null, null ,"AppsFlyerPlugin","trackAndOpenStore", [appId, campaign, params]); | ||
}; | ||
AppsFlyer.prototype.handleOpenUrl = function (url) { | ||
argscheck.checkArgs('*', 'AppsFlyer.handleOpenUrl', arguments); | ||
exec(null, null, "AppsFlyerPlugin", "handleOpenUrl", [url]); | ||
}; | ||
global.cordova.addConstructor(function () { | ||
if (!global.Cordova) { | ||
global.Cordova = global.cordova; | ||
} | ||
if (!global.plugins) { | ||
global.plugins = {}; | ||
} | ||
global.plugins.appsFlyer = new AppsFlyer(); | ||
}); | ||
} (window)); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3620252
56
1362
608