react-native-appsflyer
Advanced tools
Comparing version 5.2.0 to 5.4.1
102
Docs/API.md
@@ -680,1 +680,103 @@ # API | ||
--- | ||
##### <a id="setOneLinkCustomDomains"> **`setOneLinkCustomDomains(domains, successC, errorC)`** | ||
Set Onelink custom/branded domains<br/> | ||
Use this API during the SDK Initialization to indicate branded domains.<br/> | ||
For more information please refer to the [documentation](https://support.appsflyer.com/hc/en-us/articles/360002329137-Implementing-Branded-Links) | ||
| parameter | type | description | | ||
| ---------- |----------|------------------ | | ||
| domains | array | Comma separated array of branded domains | | ||
| successC | function | success callback | | ||
| errorC | function | error callback | | ||
*Example:* | ||
```javascript | ||
appsFlyer.setOneLinkCustomDomains(["click.mybrand.com"], | ||
(res) => { | ||
console.log(res); | ||
}, (error) => { | ||
console.log(error); | ||
}); | ||
``` | ||
--- | ||
##### <a id="setResolveDeepLinkURLs"> **`setResolveDeepLinkURLs(urls, successC, errorC)`** | ||
Set domains used by ESP when wrapping your deeplinks.<br/> | ||
Use this API during the SDK Initialization to indicate that links from certain domains should be resolved in order to get original deeplink<br/> | ||
For more information please refer to the [documentation](https://support.appsflyer.com/hc/en-us/articles/360001409618-Email-service-provider-challenges-with-iOS-Universal-links) <br/> | ||
| parameter | type | description | | ||
| ---------- |----------|------------------ | | ||
| urls | array | Comma separated array of ESP domains requiring resolving | | ||
| successC | function | success callback | | ||
| errorC | function | error callback | | ||
*Example:* | ||
```javascript | ||
appsFlyer.setResolveDeepLinkURLs(["click.esp-domain.com"], | ||
(res) => { | ||
console.log(res); | ||
}, (error) => { | ||
console.log(error); | ||
}); | ||
``` | ||
--- | ||
##### <a id="performOnAppAttribution"> **`performOnAppAttribution(url, callback)`** | ||
This function allows developers to manually re-trigger onAppOpenAttribution with a specific link (URI or URL), **without recording a new re-engagement**.<br> | ||
This method may be required if the app needs to redirect users based on the given link, or resolve the AppsFlyer short URL while staying in the foreground/opened. This might be needed because regular onAppOpenAttribution callback is only called if the app was opened with the deep link. | ||
| parameter | type | description | | ||
| ---------- |----------|------------------ | | ||
| url | string | String representing the URL that needs to be resolved/returned in the onAppOpenAttribution callback | | ||
| callback | function | Result callback | | ||
*Example:* | ||
```javascript | ||
let uriString = "sdktest://test" | ||
appsFlyer.performOnAppAttribution(uriString, (res) => { | ||
console.log(res); | ||
}) | ||
``` | ||
--- | ||
##### <a id="setSharingFilterForAllPartners"> **`setSharingFilterForAllPartners()`** | ||
Used by advertisers to exclude **all** networks/integrated partners from getting data. Learn more [here](https://support.appsflyer.com/hc/en-us/articles/207032126#additional-apis-exclude-partners-from-getting-data) | ||
*Example:* | ||
```javascript | ||
appsFlyer.setSharingFilterForAllPartners() | ||
``` | ||
--- | ||
##### <a id="setSharingFilter"> **`setSharingFilter(partners, sucessC, errorC)`** | ||
Used by advertisers to exclude **specified** networks/integrated partners from getting data. Learn more [here](https://support.appsflyer.com/hc/en-us/articles/207032126#additional-apis-exclude-partners-from-getting-data) | ||
| parameter | type | description | | ||
| ---------- |----------|------------------ | | ||
| partners | array | Comma separated array of partners that need to be excluded | | ||
| successC | function | success callback | | ||
| errorC | function | error callback | | ||
*Example:* | ||
```javascript | ||
let partners = ["facebook_int","googleadwords_int","snapchat_int","doubleclick_int"] | ||
appsFlyer.setSharingFilterForAllPartners(partners, | ||
(res) => { | ||
console.log(res); | ||
}, (error) => { | ||
console.log(error); | ||
}) | ||
``` | ||
--- |
@@ -12,2 +12,3 @@ # React Native Appsflyer Plugin Guides | ||
- [iOS Deeplink Setup](#iosdeeplinks) | ||
- [Android Deeplink Setup](#android-deeplinks) | ||
- [Uninstall](#track-app-uninstalls) | ||
@@ -37,11 +38,3 @@ - [iOS Uninstall Setup](#track-app-uninstalls-ios) | ||
*With Promise:* | ||
```javascript | ||
try { | ||
var result = await appsFlyer.initSdk(options); | ||
} catch (error) {} | ||
``` | ||
## <a id="deeplinking"> Deep Linking | ||
@@ -120,4 +113,2 @@ | ||
```javascript | ||
import React, {useEffect, useState} from 'react'; | ||
import {AppState, SafeAreaView, Text, View} from 'react-native'; | ||
import appsFlyer from 'react-native-appsflyer'; | ||
@@ -161,14 +152,4 @@ | ||
class App extends Component<{}> { | ||
state = { | ||
appState: AppState.currentState, | ||
}; | ||
componentDidMount() { | ||
AppState.addEventListener('change', this._handleAppStateChange); | ||
} | ||
componentWillUnmount() { | ||
AppState.removeEventListener('change', this._handleAppStateChange); | ||
// Optionaly remove listeners for deep link data if you no longer need them | ||
// Optionaly remove listeners for deep link data if you no longer need them after componentWillUnmount | ||
if (onInstallConversionDataCanceller) { | ||
@@ -185,11 +166,2 @@ onInstallConversionDataCanceller(); | ||
} | ||
_handleAppStateChange = (nextAppState) => { | ||
if (this.state.appState.match(/inactive|background/) && nextAppState === 'active') { | ||
if (Platform.OS === 'ios') { | ||
appsFlyer.trackAppLaunch(); | ||
} | ||
} | ||
this.setState({appState: nextAppState}); | ||
}; | ||
} | ||
@@ -242,29 +214,15 @@ ``` | ||
const [appState, setAppState] = useState(AppState.currentState); | ||
useEffect(() => { | ||
function handleAppStateChange(nextAppState) { | ||
if (appState.match(/inactive|background/) && nextAppState === 'active') { | ||
if (Platform.OS === 'ios') { | ||
appsFlyer.trackAppLaunch(); | ||
} | ||
return () => { | ||
// Optionaly remove listeners for deep link data if you no longer need them after componentWillUnmount | ||
if (onInstallConversionDataCanceller) { | ||
onInstallConversionDataCanceller(); | ||
console.log('unregister onInstallConversionDataCanceller'); | ||
onInstallConversionDataCanceller = null; | ||
} | ||
if (appState.match(/active|foreground/) && nextAppState === 'background') { | ||
if (onInstallConversionDataCanceller) { | ||
onInstallConversionDataCanceller(); | ||
onInstallConversionDataCanceller = null; | ||
} | ||
if (onAppOpenAttributionCanceller) { | ||
onAppOpenAttributionCanceller(); | ||
onAppOpenAttributionCanceller = null; | ||
} | ||
if (onAppOpenAttributionCanceller) { | ||
onAppOpenAttributionCanceller(); | ||
console.log('unregister onAppOpenAttributionCanceller'); | ||
onAppOpenAttributionCanceller = null; | ||
} | ||
setAppState(nextAppState); | ||
} | ||
AppState.addEventListener('change', handleAppStateChange); | ||
return () => { | ||
AppState.removeEventListener('change', handleAppStateChange); | ||
}; | ||
@@ -322,6 +280,25 @@ }); | ||
``` | ||
--- | ||
### <a id="android-deeplinks"> Android Deep Links | ||
On Android, AppsLyer SDK inspects activity intent object during onResume(). Because if that, for each activity that may be configured or launched with any [non-standard launch mode](https://developer.android.com/guide/topics/manifest/activity-element#lmode) please make sure to add the following code to `MainActivity.java` in `android/app/src/main/java/com...`: | ||
``` | ||
... | ||
import android.content.Intent; | ||
... | ||
public class MainActivity extends ReactActivity { | ||
... | ||
@Override | ||
public void onNewIntent(Intent intent) { | ||
super.onNewIntent(intent); | ||
setIntent(intent); | ||
} | ||
} | ||
``` | ||
This method makes sure that you get the latest deep link data even if the app was initially launched with another deep link. See the [Android developer documentation](https://developer.android.com/reference/android/app/Activity#onNewIntent(android.content.Intent)) for more details. | ||
--- | ||
### <a id="track-app-uninstalls"> Track App Uninstalls | ||
@@ -328,0 +305,0 @@ |
@@ -51,2 +51,3 @@ /** | ||
onInstallConversionData(callback:(data:ConversionData)=>any): () => void; | ||
onInstallConversionFailure(callback:(data:ConversionData)=>any): () => void; | ||
onAppOpenAttribution(callback:(data:any)=>any): () => void; | ||
@@ -57,12 +58,17 @@ | ||
setUserEmails(options:SetEmailsOptions, successC?:SuccessCB, errorC?:ErrorCB): void | ||
setAdditionalData(additionalData:object, successC?:SuccessCB): void | ||
getAppsFlyerUID(callback:(error:Error, uid:string)=>any): void | ||
setCustomerUserId(userId:string, successC?:SuccessCB): void | ||
stopTracking(isStopTracking:boolean, successC?:SuccessCB): void | ||
setAppInviteOneLinkID(oneLinkID:string, successC?:SuccessCB): void | ||
generateInviteLink(params:GenerateInviteLinkParams, successC?:SuccessCB, errorC?:ErrorCB): void | ||
trackCrossPromotionImpression(appId:string, campaign:string): void | ||
trackAndOpenStore(appId:string, campaign:string, params: object): void | ||
setCurrencyCode(currencyCode:string, successC:SuccessCB): void | ||
setDeviceTrackingDisabled(isDeviceTrackingDisabled:boolean, successC:SuccessCB): void | ||
setAdditionalData(additionalData: object, successC?: SuccessCB): void | ||
getAppsFlyerUID(callback: (error: Error, uid: string) => any): void | ||
setCustomerUserId(userId: string, successC?: SuccessCB): void | ||
stopTracking(isStopTracking: boolean, successC?: SuccessCB): void | ||
setAppInviteOneLinkID(oneLinkID: string, successC?: SuccessCB): void | ||
generateInviteLink(params: GenerateInviteLinkParams, successC?: SuccessCB, errorC?: ErrorCB): void | ||
trackCrossPromotionImpression(appId: string, campaign: string): void | ||
trackAndOpenStore(appId: string, campaign: string, params: object): void | ||
setCurrencyCode(currencyCode: string, successC: SuccessCB): void | ||
setDeviceTrackingDisabled(isDeviceTrackingDisabled: boolean, successC: SuccessCB): void | ||
setOneLinkCustomDomains(domains: string[], successC?: SuccessCB, errorC?: ErrorCB): void | ||
setResolveDeepLinkURLs(urls: string[], successC?: SuccessCB, errorC?: ErrorCB): void | ||
performOnAppAttribution(urlString, callback): void | ||
setSharingFilterForAllPartners(): void | ||
setSharingFilter(partners, successC, errorC): void | ||
@@ -73,3 +79,3 @@ /** | ||
trackAppLaunch(): void | ||
trackLocation(longitude:number, latitude:number, callback:SuccessCB): void | ||
trackLocation(longitude: number, latitude: number, callback: SuccessCB): void | ||
@@ -76,0 +82,0 @@ /** |
68
index.js
@@ -1,2 +0,2 @@ | ||
import { NativeEventEmitter, NativeModules } from "react-native"; | ||
import {NativeEventEmitter, NativeModules} from "react-native"; | ||
@@ -251,3 +251,2 @@ const { RNAppsFlyer } = NativeModules; | ||
appsFlyer.onInstallConversionData = callback => { | ||
//console.log("onInstallConversionData is called" ); | ||
@@ -278,2 +277,28 @@ const listener = appsFlyerEventEmitter.addListener( | ||
appsFlyer.onInstallConversionFailure = callback => { | ||
const listener = appsFlyerEventEmitter.addListener( | ||
"onInstallConversionFailure", | ||
_data => { | ||
if (callback && typeof callback === typeof Function) { | ||
try { | ||
let data = JSON.parse(_data); | ||
callback(data); | ||
} catch (_error) { | ||
//throw new AFParseJSONException("..."); | ||
//TODO: for today we return an error in callback | ||
callback(new AFParseJSONException("Invalid data structure", _data)); | ||
} | ||
} | ||
} | ||
); | ||
eventsMap["onInstallConversionFailure"] = listener; | ||
// unregister listener (suppose should be called from componentWillUnmount() ) | ||
return function remove() { | ||
listener.remove(); | ||
}; | ||
}; | ||
appsFlyer.onAppOpenAttribution = callback => { | ||
@@ -310,3 +335,3 @@ | ||
* Default is false | ||
* @param isDeviceTrackingDisabled boolean | ||
* @param isDeviceTrackingDisabled boolean | ||
* @param successC success callback function. | ||
@@ -318,2 +343,39 @@ */ | ||
/** | ||
* Set Onelink custom/branded domains | ||
* Use this API during the SDK Initialization to indicate branded domains. | ||
* For more information please refer to https://support.appsflyer.com/hc/en-us/articles/360002329137-Implementing-Branded-Links | ||
* @param domains array of strings | ||
* @param successC success callback function. | ||
* @param errorC error callback function. | ||
*/ | ||
appsFlyer.setOneLinkCustomDomains = (domains, successC, errorC) => { | ||
return RNAppsFlyer.setOneLinkCustomDomains(domains, successC, errorC); | ||
}; | ||
/** | ||
* Set domains used by ESP when wrapping your deeplinks. | ||
* Use this API during the SDK Initialization to indicate that links from certain domains should be resolved | ||
* in order to get original deeplink | ||
* For more information please refer to https://support.appsflyer.com/hc/en-us/articles/360001409618-Email-service-provider-challenges-with-iOS-Universal-links | ||
* @param urls array of strings | ||
* @param successC success callback function. | ||
* @param errorC error callback function. | ||
*/ | ||
appsFlyer.setResolveDeepLinkURLs = (urls, successC, errorC) => { | ||
return RNAppsFlyer.setResolveDeepLinkURLs(urls, successC, errorC); | ||
}; | ||
appsFlyer.performOnAppAttribution = (urlString, callback) => { | ||
return RNAppsFlyer.performOnAppAttribution(urlString, callback); | ||
} | ||
appsFlyer.setSharingFilterForAllPartners = () => { | ||
return RNAppsFlyer.setSharingFilterForAllPartners(); | ||
} | ||
appsFlyer.setSharingFilter = (partners, successC, errorC) => { | ||
return RNAppsFlyer.setSharingFilter(partners, successC, errorC); | ||
} | ||
function AFParseJSONException(_message, _data) { | ||
@@ -320,0 +382,0 @@ this.message = _message; |
{ | ||
"name": "react-native-appsflyer", | ||
"version": "5.2.0", | ||
"version": "5.4.1", | ||
"description": "React Native Appsflyer plugin", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -22,4 +22,4 @@ | ||
- iOS AppsFlyerSDK **v5.2.0** | ||
- Android AppsFlyerSDK **v5.2.0** | ||
- iOS AppsFlyerSDK **v5.4.1** | ||
- Android AppsFlyerSDK **v5.4.1** | ||
@@ -26,0 +26,0 @@ |
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 10 instances in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
647518
77
428
11