APIリファレンス

APIs

このプラグインで使用可能なメソッドのリストを以下に説明します。


Android and iOS APIs

initSdk

initSdk(options, success, error)

Initialize the AppsFlyer SDK with the devKey and appID.

The dev key is required for all apps and the appID is required only for iOS.

(you may pass the appID on Android as well, and it will be ignored)

parametertypedescription
optionsJSONinit options
successfunctionsuccess callback
エラーfunctionerror callback
設定項目詳細
devKeyYour application devKey provided by AppsFlyer (required)
appIdApp ID (iOS only) you configured in your AppsFlyer dashboard
isDebugDebug mode - set to true for testing only
onInstallConversionDataListenerSet listener for GCD response (Optional. default=true)
onDeepLinkListenerSet listener for UDL response (Optional. default=false)
timeToWaitForATTUserAuthorizationWaits for request user authorization to access app-related data. please read more Here
manualStartPrevents from the SDK from sending the launch request after using appsFlyer.initSdk(...). When using this property, the apps needs to manually trigger the appsFlyer.startSdk() API to report the app launch. read more here. (Optional, default=false)


例:

import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import appsFlyer from 'react-native-appsflyer';

appsFlyer.initSdk(
  {
    devKey: 'K2***********99',
    isDebug: false,
    appId: '41*****44',
    onInstallConversionDataListener: false, //Optional
    onDeepLinkListener: true, //Optional
    timeToWaitForATTUserAuthorization: 10, //for iOS 14.5
    manualStart: true, //Optional
  },
  (res) => {
    console.log(res);
  },
  (err) => {
    console.error(err);
  }
);

startSDK

startSdk()

In version 6.9.1 of the react-native-appslfyer SDK we added the option of splitting between the initialization stage and start stage. All you need to do is add the property manualStart: true to the init object, and later call appsFlyer.startSdk() whenever you decide. If this property is set to false or doesn’t exist, the sdk will start after calling appsFlyer.initSdk(...).


例:

const option = {
  isDebug: true,
  devKey: 'UsxXxXxed',
  appId: '75xXxXxXxXx11',
  onInstallConversionDataListener: true,
  onDeepLinkListener: true,
  timeToWaitForATTUserAuthorization: 5,
  manualStart: true, // <--- for manual start.
};

appsFlyer.initSdk(
  option,
  () => {
    if (!option.manualStart) {
      console.warn('AppsFlyer SDK started!');
    } else {
      console.warn('AppsFlyer SDK init, didn\'t send launch yet');
      }
    },
      err => {
        // handle error
      },
    );
    //...
    // app flow
    //...

  appsFlyer.startSdk(); // <--- Here we send launch

logEvent

logEvent(eventName, eventValues, success, error)

アプリ内イベントにより、アプリ内の動作に関するインサイトを得ることができます。ROI(投資収益率)やLTV(顧客生涯価値)を計測するために、時間を取って計測するイベントを定義することをお勧めします。

Recording in-app events is performed by calling logEvent with event name and value parameters. See In-App Events documentation for more details.

Note: An In-App Event name must be no longer than 45 characters. Events names with more than 45 characters do not appear in the dashboard, but only in the raw Data, Pull and Push APIs.

parametertypedescription
eventName文字列イベントの名前
イベント値JSONイベントと共に送信されるイベント値
successfunctionsuccess callback
エラーfunctionsuccess callback


例:

const eventName = 'af_add_to_cart';
const eventValues = {
  af_content_id: 'id123',
  af_currency: 'USD',
  af_revenue: '2',
};

appsFlyer.logEvent(
  eventName,
  eventValues,
  (res) => {
    console.log(res);
  },
  (err) => {
    console.error(err);
  }
);

setCustomerUserId

setCustomerUserId(userId, callback)

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.

If you wish to see the CUID (Customer User ID) under your installs raw data reports, it should be called before starting the SDK.

If you simply would like to add additional user id to the events raw data reports, then you can freely call it anytime you need.

parametertypedescription
userId文字列user ID
callbackfunctionsuccess callback


例:

appsFlyer.setCustomerUserId('some_user_id', (res) => {
  //..
});

stop

stop(isStopped, callback)

稀ではあっても場合によっては、法律やプライバシー遵守のために、すべてのSDKにおける計測を停止しなければならないケースがあります。その場合、stopSDK APIを利用可能です。このAPIが呼び出されると、SDKはサーバーとの通信を停止し、機能しなくなります。

ユーザーのオプトアウトには、さまざまなシナリオがあります。AppsFlyerでは、アプリに適したシナリオにあわせて正しい手順を守り、実装するよう推奨します。

なお、同じAPIにてfalseを渡して呼び出すことにより、SDKを再アクティブ化することができます。

parametertypedescription
isStoppedbooleanSDKが停止している場合:true(デフォルト値: false)
callbackfunctionsuccess callback


例:

appsFlyer.stop(true, (res) => {
  //...
});

setAppInviteOneLinkID

setAppInviteOneLinkID(oneLinkID, callback)

Set the OneLink ID that should be used for User-Invite-API.

The link that is generated for the user invite will use this OneLink ID as the base link ID.

parametertypedescription
OneLink ID文字列OneLink ID
callbackfunctionsuccess callback


例:

appsFlyer.setAppInviteOneLinkID('abcd', (res) => {
  //...
});

setAdditionalData

setAdditionalData(additionalData, callback)

Segment、Adobe、Urban Airshipなどの外部のパートナープラットフォームとSDKレベルで連携する際には、setAdditionalDataのAPIが必要です。
このAPIは、各プラットフォームの連携のサポートページに、setAdditionalDataのAPIが必要であると記載されている場合にのみ、使用してください。

parametertypedescription
追加データJSON追加データ
callbackfunctionsuccess callback


例:

appsFlyer.setAdditionalData(
  {
    val1: 'data1',
    val2: false,
    val3: 23,
  },
  (res) => {
    //...
  }
);

setResolveDeepLinkURLs

setResolveDeepLinkURLs(urls, 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 the documentation

parametertypedescription
urlsArrayComma separated array of ESP domains requiring resolving
successCfunctionsuccess callback
errorCfunctionerror callback


例:

appsFlyer.setResolveDeepLinkURLs(["click.esp-domain.com"],
    (res) => {
        console.log(res);
    }, (error) => {
        console.log(error);
    });

setOneLinkCustomDomains

setOneLinkCustomDomains(domains, successC, errorC)

Set Onelink custom/branded domains

Use this API during the SDK Initialization to indicate branded domains.

For more information please refer to the documentation

parametertypedescription
domainsArrayComma separated array of branded domains
successCfunctionsuccess callback
errorCfunctionerror callback


例:

appsFlyer.setOneLinkCustomDomains(["click.mybrand.com"],
    (res) => {
        console.log(res);
    }, (error) => {
        console.log(error);
    });

setCurrencyCode

setCurrencyCode(currencyCode, callback)

Setting user local currency code for in-app purchases.

The currency code should be a 3 character ISO 4217 code. (default is USD).

You can set the currency code for all events by calling the following method.

parametertypedescription
currencyCode文字列currencyCode
callbackfunctionsuccess callback


例:

appsFlyer.setCurrencyCode(currencyCode, () => {});

logLocation

logLocation(longitude, latitude, callback)

ユーザーのロケーションをマニュアルで記録します。

parametertypedescription
経度Float経度
緯度Float緯度
callbackfunctionSuccess / Error Callbacks


例:

const latitude = -18.406655;
const longitude = 46.40625;

appsFlyer.logLocation(longitude, latitude, (err, coords) => {
  if (err) {
    console.error(err);
  } else {
    //...
  }
});

anonymizeUser

anonymizeUser(shouldAnonymize, callback)

It is possible to anonymize specific user identifiers within AppsFlyer analytics.
This complies with both the latest privacy requirements (GDPR, COPPA) and Facebook's data and privacy policies.
To anonymize an app user.

parametertypedescription
shouldAnonymizebooleanTrue if want Anonymize user Data (default value is false).
callbackfunctionsuccess callback


例:

appsFlyer.anonymizeUser(true, () => {});

getAppsFlyerUID

getAppsFlyerUID(callback)

AppsFlyerのユニークIDは、アプリの新規インストールごとに採番されます。
AppsFlyerのユニークIDを取得するには、次のAPIを使用します。

parametertypedescription
callbackfunction返されるコード (error, appsFlyerUID)


例:

appsFlyer.getAppsFlyerUID((err, appsFlyerUID) => {
  if (err) {
    console.error(err);
  } else {
    console.log('on getAppsFlyerUID: ' + appsFlyerUID);
  }
});

setHost

setHost(hostPrefix, hostName, successC)

カスタムホストを設定します。

parametertypedescription
hostPrefix文字列the host prefix
hostName文字列the host name
successCfunctionsuccess callback


例:

appsFlyer.setHost('foo', 'bar.appsflyer.com', res => console.log(res));

setUserEmails

setUserEmails(options, success, error)

Set the user emails and encrypt them.
Note: Android and iOS platforms supports only 0 (none) and 3 (SHA256) emailsCryptType.
When unsupported emailsCryptType is passed, the SDK will use the default (none).

parametertypedescription
configurationJSONemail configuration
successfunctionsuccess callback
エラーfunctionerror callback
optiontypedescription
emailsCryptTypeintnone - 0 (default), SHA256 - 3
emailsArraycomma separated list of emails


例:

const options = {
  // In this case iOS platform will encrypt emails usind MD5 and android with SHA256. If you want both platform to encrypt with the same method, just write 0 or 3.
  emailsCryptType: Platform.OS === 'ios' ? 2 : 3, 
  emails: ['[email protected]', '[email protected]'],
};

appsFlyer.setUserEmails(
  options,
  (res) => {
    //...
  },
  (err) => {
    console.error(err);
  }
);

generateInviteLink

generateInviteLink(parameters, success, error)

parametertypedescription
パラメーターJSONparameters for Invite link
successfunctionsuccess callback (generated link)
エラーfunctionerror callback


例:

appsFlyer.generateInviteLink(
 {
   channel: 'gmail',
   campaign: 'myCampaign',
   customerID: '1234',
   userParams: {
     myParam: 'newUser',
     anotherParam: 'fromWeb',
     amount: 1,
   },
 },
 (link) => {
   console.log(link);
 },
 (err) => {
   console.log(err);
 }
);

A complete list of supported parameters is available here. Custom parameters can be passed using a userParams{} nested object, as in the example above.


setSharingFilterForAllPartners

setSharingFilterForAllPartners()

Deprecated! Start from version 6.4.0 please use setSharingFilterForPartners
Used by advertisers to exclude all networks/integrated partners from getting data. Learn more here


例:

appsFlyer.setSharingFilterForAllPartners()

setSharingFilter

setSharingFilter(partners, sucessC, errorC)

Deprecated! Start from version 6.4.0 please use setSharingFilterForPartners
Used by advertisers to exclude specified networks/integrated partners from getting data. Learn more here

parametertypedescription
partnersArrayComma separated array of partners that need to be excluded
successCfunctionsuccess callback
errorCfunctionerror callback


例:

let partners = ["facebook_int","googleadwords_int","snapchat_int","doubleclick_int"]
appsFlyer.setSharingFilterForAllPartners(partners,
        (res) => {
            console.log(res);
        }, (error) => {
            console.log(error);
        })

setSharingFilterForPartners

setSharingFilterForPartners(partners)

Used by advertisers to exclude networks/integrated partners from getting data.

parametertypedescription
partnersArrayComma separated array of partners that need to be excluded


例:

appsFlyer.setSharingFilterForPartners([]);                                        // Reset list (default)
appsFlyer.setSharingFilterForPartners(null);                                      // Reset list (default)
appsFlyer.setSharingFilterForPartners(['facebook_int']);                          // Single partner
appsFlyer.setSharingFilterForPartners(['facebook_int', 'googleadwords_int']);     // Multiple partners
appsFlyer.setSharingFilterForPartners(['all']);                                   // All partners
appsFlyer.setSharingFilterForPartners(['googleadwords_int', 'all']);              // All partners

validateAndLogInAppPurchase

validateAndLogInAppPurchase(purchaseInfo, successC, errorC): Response<string>
Receipt validation is a secure mechanism whereby the payment platform (e.g. Apple or Google) validates that an in-app purchase indeed occurred as reported.
Learn more - https://support.appsflyer.com/hc/en-us/articles/207032106-Receipt-validation-for-in-app-purchases
❗Important❗ for iOS - set SandBox to true
appsFlyer.setUseReceiptValidationSandbox(true);

parametertypedescription
purchaseInfoJSONIn-App Purchase parameters
successCfunctionsuccess callback (generated link)
errorCfunctionerror callback


例:

let info = {
        publicKey: 'key',
        currency: 'biz',
        signature: 'sig',
        purchaseData: 'data',
        price: '123',
        productIdentifier: 'identifier',
        currency: 'USD',
        transactionId: '1000000614252747',
        additionalParameters: {'foo': 'bar'},
    };

appsFlyer.validateAndLogInAppPurchase(info, res => console.log(res), err => console.log(err));

updateServerUninstallToken

updateServerUninstallToken(token, callback)

Manually pass the Firebase / GCM Device Token for Uninstall measurement.

parametertypedescription
token文字列FCM Token
callbackfunctionsuccess callback


例:

appsFlyer.updateServerUninstallToken('token', (res) => {
  //...
});

sendPushNotificationData

sendPushNotificationData(pushPayload, ErrorCB): void
Push-notification campaigns are used to create fast re-engagements with existing users.

Learn more

For Android platform, AppsFlyer SDK uses the activity in order to process the push payload. Make sure you call this api when the app's activity is available (NOT dead state).

From version 6.6.0 we added an error callback that returns an error message.

parametertypedescription
pushPayloadJSONpush notification payload
ErrorCBfunctionreturns an error msg when the payload has not been sent


例:

const pushPayload = {
            af:{
                c:"test_campaign",
                is_retargeting:true,
                pid:"push_provider_int",
            },
            aps:{
                alert:"Get 5000 Coins",
                badge:"37",
                sound:"default"
            }
        };
        appsFlyer.sendPushNotificationData(pushPayload, err => console.log(err));

addPushNotificationDeepLinkPath

addPushNotificationDeepLinkPath(path, SuccessCB, ErrorCB): void

キーの配列を追加します。これは、プッシュ通知のペイロードからディープリンクを解決するためのキーパスを構成するために使用されます。

parametertypedescription
pathArrayarray of Strings that corresponds to the JSON path of the deep link.
successCBfunctionsuccess callback
errorCBfunctionerror callback


例:

let path = ['deeply', 'nested', 'deep_link'];
appsFlyer.addPushNotificationDeepLinkPath(
  path,
  res => console.log(res),
  error => console.log(error),
);

この呼び出しは、以下のペイロードの構造と一致します:

{
  ...
  "deeply": {
    "nested": {
      "deep_link": "https://yourdeeplink2.onelink.me"
    }
  }
  ...
}

appendParametersToDeepLinkingURL

appendParametersToDeepLinkingURL(contains, parameters): void

Matches URLs that contain contains as a substring and appends query parameters to them. In case the URL does not match, parameters are not appended to it.

Note:

  1. The parameters object must be consisted of string key and string value
  2. Call this api before calling appsFlyer.initSDK()
  3. You must provide the following parameters:
    pid, is_retargeting most be set to 'true'
parametertypedescription
含む文字列The string to check in URL
パラメーターobject検証に成功後、ディープリンクURLに追加するパラメータ


例:

appsFlyer.appendParametersToDeepLinkingURL('substring-of-url', {param1: 'value', pid: 'value2', is_retargeting: 'true'});

disableAdvertisingIdentifier

disableAdvertisingIdentifier(shouldDisdable): void

Disables collection of various Advertising IDs by the SDK.

Anroid: Google Advertising ID (GAID), OAID and Amazon Advertising ID (AAID)

iOS: Apple's advertisingIdentifier (IDFA)

parametertypedescription
shouldDisdablebooleanFlag that disable/enable Advertising ID collection


例:

appsFlyer.disableAdvertisingIdentifier(true);

enableTCFDataCollection

enableTCFDataCollection(enabled): void

instruct the SDK to collect the TCF data from the device.

parametertypedescription
enabledbooleanenable/disable TCF data collection


例:

appsFlyer.enableTCFDataCollection(true);

setConsentData

setConsentData(consentObject): void

When GDPR applies to the user and your app does not use a CMP compatible with TCF v2.2, use this API to provide the consent data directly to the SDK.

The AppsFlyerConsent object has 2 methods:

  1. AppsFlyerConsent.forNonGDPRUser: Indicates that GDPR doesn’t apply to the user and generates nonGDPR consent object. This method doesn’t accept any parameters.
  2. AppsFlyerConsent.forGDPRUser: create an AppsFlyerConsent object with 2 parameters:
parametertypedescription
hasConsentForDataUsagebooleanIndicates whether the user has consented to use their data for advertising purposes
hasConsentForAdsPersonalizationbooleanIndicates whether the user has consented to use their data for personalized advertising


例:

import appsFlyer, {AppsFlyerConsent} from 'react-native-appsflyer';

let nonGDPRUser = AppsFlyerConsent.forNonGDPRUser();
// OR
let GDPRUser = AppsFlyerConsent.forGDPRUser(true, false);

appsFlyer.setConsentData(nonGDPRUser /**or**/ GDPRUser);

logAdRevenue - Since 6.15.1

logAdRevenue(data: AFAdRevenueData): void

Use this method to log your ad revenue.

By attributing ad revenue, app owners gain the complete view of user LTV and campaign ROI.
Ad revenue is generated by displaying ads on rewarded videos, offer walls, interstitials, and banners in an app.

パラメーター

Paramタイプ
dataAFAdRevenueData

Usage Example for React Native:

const adRevenueData = {
  monetizationNetwork: 'AF-AdNetwork',
  mediationNetwork: MEDIATION_NETWORK.IRONSOURCE,
  currencyIso4217Code: 'USD',
  revenue: 1.23,
  additionalParameters: {
    customParam1: 'value1',
    customParam2: 'value2',
  }
};

appsFlyer.logAdRevenue(adRevenueData);

Here's how you use appsFlyer.logAdRevenue within a React Native app:

  1. Prepare the adRevenueData object as shown, including any additional parameters you wish to track along with the ad revenue event.
  2. API appsFlyer.logAdRevenue method with the adRevenueData object.

By passing all the required fields in AFAdRevenueData, you help ensure accurate tracking within the AppsFlyer platform. This enables you to analyze your ad revenue alongside other user acquisition data to optimize your app's overall monetization strategy.

Note: The additionalParameters object is optional. You can add any additional data you want to log with the ad revenue event in this object. This can be useful for detailed analytics or specific event tracking later on. Make sure that the custom parameters follow the data types and structures specified by AppsFlyer in their documentation.

Android Only APIs

setCollectAndroidID

setCollectAndroidID(isCollect, callback)

Opt-out of collection of Android ID.

If the app does NOT contain Google Play Services, Android ID is collected by the SDK.

However, apps with Google play services should avoid Android ID collection as this is in violation of the Google Play policy.

parametertypedescription
isCollectbooleanopt-in boolean
callbackfunctionsuccess callback


例:

if (Platform.OS == 'android') {
appsFlyer.setCollectAndroidID(true, (res) => {
   //...
});
}

setCollectIMEI

setCollectIMEI(isCollect, callback)

Opt-out of collection of IMEI.

If the app does NOT contain Google Play Services, device IMEI is collected by the SDK.

However, apps with Google play services should avoid IMEI collection as this is in violation of the Google Play policy.

parametertypedescription
isCollectbooleanopt-in boolean
callbackfunctionsuccess callback


例:

if (Platform.OS == 'android') {
appsFlyer.setCollectIMEI(false, (res) => {
   //...
});
}

setDisableNetworkData setDisableNetworkData(disable)

デバイスからネットワーク事業者名 (キャリア) とSIM 事業者名の収集をオプトアウトするために使用します。

parametertypedescription
無効化booleanDefaults to false.


例:

if (Platform.OS == 'android') {
appsFlyer.setDisableNetworkData(true);
}

performOnDeepLinking

performOnDeepLinking()

Enables manual triggering of deep link resolution. This method allows apps that are delaying the call to appsFlyer.startSdk() to resolve deep links before the SDK starts.

Note:
This API will trigger the appsFlyer.onDeepLink callback. In the following example, we check if res.deepLinkStatus is equal to “FOUND” inside appsFlyer.onDeepLink callback to extract the deeplink parameters.


例:

// Let's say we want the resolve a deeplink and get the deeplink params when the user clicks on it but delay the actual 'start' of the sdk (not sending launch to appsflyer). 

const option = {
  isDebug: true,
  devKey: 'UsxXxXxed',
  appId: '75xXxXxXxXx11',
  onInstallConversionDataListener: true,
  onDeepLinkListener: true,
  manualStart: true, // <--- for manual start.
};

const onDeepLink = appsFlyer.onDeepLink(res => {
  if (res.deepLinkStatus == 'FOUND') {
      // here we will get the deeplink params after resolving it.
      // more flow...
  }
});

appsFlyer.initSdk(
  option,
  () => {
    if (!option.manualStart) {
      console.warn('AppsFlyer SDK started!');
    } else {
      console.warn('AppsFlyer SDK init, didn\'t send launch yet');
      }
    },
  () => {},
);

if (Platform.OS == 'android') {
  appsFlyer.performOnDeepLinking();
}

// more app flow...

appsFlyer.startSdk(); // <--- Here we send launch

iOS Only APIs

disableCollectASA

disableCollectASA(shouldDisable)

Disables Apple Search Ads collecting

parametertypedescription
shouldDisablebooleanFlag to disable/enable Apple Search Ads data collection


例:

if (Platform.OS == 'ios') {
appsFlyer.disableCollectASA(true);
}

disableIDFVCollection

disableIDFVCollection(shouldDisable)

Disables app vendor identifier (IDFV) collection in iOS.

Default is false (the SDK will collect IDFV).

parametertypedescription
shouldDisablebooleanFlag to disable/enable IDFV collection


例:

if (Platform.OS == 'ios') {
appsFlyer.disableIDFVCollection(true);
}

setUseReceiptValidationSandbox

void setUseReceiptValidationSandbox(bool useReceiptValidationSandbox)

iOS(本番環境 or サンドボックス)でのアプリ内課金の検証をします。デフォルト設定はfalseです。

parametertypedescription
setUseReceiptValidationSandboxbooleanアプリ内購入がサンドボックスで行われる場合:true


例:

appsFlyer.setUseReceiptValidationSandbox(true);

disableSKAD

disableSKAD(disableSkad)

❗Important❗ disableSKAD must be called before calling initSDK and for iOS ONLY!

parametertypedescription
disableSkadbooleantrue if you want to disable SKADNetwork


例:

if (Platform.OS == 'ios') {
    appsFlyer.disableSKAD(true);
}

setCurrentDeviceLanguage

setCurrentDeviceLanguage(language)

Set the language of the device. The data will be displayed in Raw Data Reports

If you want to clear this property, set an empty string. ("")

parametertypedescription
language文字列language of the device


例:

if (Platform.OS == 'ios') {
    appsFlyer.setCurrentDeviceLanguage("EN");
}

AppsFlyerConversionData

onInstallConversionData

onInstallConversionData(callback) : function:unregister

Accessing AppsFlyer Attribution / Conversion Data from the SDK (Deferred Deeplinking).

コンバージョンリスナーのコード実装は、SDKの初期化コードより前に行う必要があります。

parametertypedescription
callbackfunctionconversion data result


例:

const onInstallConversionDataCanceller = appsFlyer.onInstallConversionData(
  (res) => {
    if (JSON.parse(res.data.is_first_launch) == true) {
      if (res.data.af_status === 'Non-organic') {
        var media_source = res.data.media_source;
        var campaign = res.data.campaign;
        alert('This is first launch and a Non-Organic install. Media source: ' + media_source + ' Campaign: ' + campaign);
      } else if (res.data.af_status === 'Organic') {
        alert('This is first launch and a Organic Install');
      }
    } else {
      alert('This is not first launch');
    }
  }
);

appsFlyer.initSdk(/*...*/);

Example onInstallConversionData:

{
  "data": {
    "af_message": "organic install",
    "af_status": "Organic",
    "is_first_launch": "true"
  },
  "status": "success",
  "type": "onInstallConversionDataLoaded"
}

Note** is_first_launch will be "true" (string) on Android and true (boolean) on iOS. To solve this issue wrap is_first_launch with JSON.parse(res.data.is_first_launch) as in the example above.

appsFlyer.onInstallConversionData returns a function the will allow us to call NativeAppEventEmitter.remove().


onInstallConversionFailure

onInstallConversionFailure(callback) : function:unregister

parametertypedescription
callbackfunctionFailed conversion data result


例:

    const onInstallGCDFailure = appsFlyer.onInstallConversionFailure(res => {
      console.log(JSON.stringify(res, null, 2));
    });

Example onInstallConversionFailure:

{
  "status": "failure",
  "type": "onInstallConversionFailure",
  "data": "DevKey is incorrect"
}

onAppOpenAttribution

onAppOpenAttribution(callback) : function:unregister

This API is related to DeepLinks. Please read more here

parametertypedescription
callbackfunctiononAppOpenAttribution data result


例:

const onAppOpenAttributionCanceller = appsFlyer.onAppOpenAttribution((res) => {
  console.log(res);
});

appsFlyer.initSdk(/*...*/);

onAttributionFailure

onAttributionFailure(callback) : function:unregister

This API is related to DeepLinks. Please read more here

parametertypedescription
callbackfunctiononAppOpenAttribution data error


例:

const onAppOpenAttributionCanceller = appsFlyer.onAttributionFailure((res) => {
  console.log(res);
});

appsFlyer.initSdk(/*...*/);

onDeepLink

onDeepLink(callback) : function:unregister

This API is related to DeepLinks. Please read more here

parametertypedescription
callbackfunctionUDL data error


例:

const onDeepLinkCanceller = appsFlyer.onDeepLink(res => {
  if (res?.deepLinkStatus !== 'NOT_FOUND') {
        const DLValue = res?.data.deep_link_value;
        const mediaSrc = res?.data.media_source;
        const param1 = res?.data.af_sub1;
        console.log(JSON.stringify(res?.data, null, 2));
      }
})

appsFlyer.initSdk(/*...*/);