Skip to content

Latest commit

 

History

History
executable file
·
981 lines (706 loc) · 48.1 KB

File metadata and controls

executable file
·
981 lines (706 loc) · 48.1 KB

API

The list of available methods for this plugin is described below.

Removed in 7.0

The following methods were removed with no replacement — see RELEASENOTES.md for the full breaking-change list:

  • registerOnAppOpenAttribution — folded into registerDeepLinkListener's onDeepLinking callback.
  • registerUninstall (iOS APNs token) — no equivalent method in the new RPC schema.
  • setSharingFilter / setSharingFilterForAllPartners — already deprecated pre-7.0; superseded by setSharingFilterForPartners.

Every remaining method is now Promise-based: fn(args, successCallback, errorCallback) calls became await AppsFlyer.fn(params), with a single params object. Failures throw AppsFlyerRpcError or AppsFlyerError instead of invoking an error callback.

method name params description
init ({devKey, appId?}): Promise<void> Initialize the SDK
start (params?: {awaitResponse?}): Promise<void> Starts the SDK - must be called from inside registerSessionReadyListener's callback
registerSessionReadyListener (onReady): Promise<void> Register the session-ready callback; call start() inside it
logEvent ({eventName, eventValues?, awaitResponse?}): Promise<void> Track rich in-app events
registerDeepLinkListener ({onDeepLinking}): Promise<void> Get unified deep link data (also covers what used to be app-open attribution)
setCurrencyCode ({currencyCode}): Promise<void> Set currency code
setCustomerUserId ({customerId}): Promise<void> Set custom_user_id
getAppsFlyerUID (): Promise<string | null> Get AppsFlyer’s proprietary Device ID
anonymizeUser ({shouldAnonymize}): Promise<void> Anonymize user data
stop ({shouldStop}): Promise<void> Shut down all SDK tracking
updateServerUninstallToken ({token}): Promise<void> (Android) Pass GCM/FCM Tokens
setAppInviteOneLink ({oneLinkId}): Promise<void> Set AppsFlyer’s OneLink ID
generateInviteLink (params?: {parameters?, awaitResponse?}): Promise<string> Generate a user-invite link
logCrossPromoteImpression ({appId, campaign?, userParams?}): Promise<void> Track cross promotion impression
logAndOpenStore ({promotedAppId, campaign?, userParams?}): Promise<void> Launch the app store's app page (via Browser)
handleOpenUrl ({url, options?}): Promise<void> iOS only. Forward a URL-scheme open to the SDK
handleOpenURL ({url, options?}): Promise<void> iOS only. Case-variant of handleOpenUrl, kept for hand-integrated AppDelegates
getSdkVersion (): Promise<string> Get the current SDK version
setSharingFilterForPartners ({partners}): Promise<void> Used by advertisers to exclude specified networks/integrated partners from getting data
validateAndLogInAppPurchase ({purchase, additionalParameters?}): Promise<Record<string, unknown>> API for server verification of in-app purchases
setUseReceiptValidationSandbox ({sandbox}): Promise<void> In app purchase receipt validation Apple environment
setDisableCollectASA ({disable}): Promise<void> iOS - set the SDK to load OR not to load iAd.framework dynamically
setDisableAdvertisingIdentifiers ({disable}): Promise<void> Disable collection of Apple, Google, Amazon and Open advertising ids (IDFA, GAID, AAID, OAID).
setOneLinkCustomDomain ({domains}): Promise<void> Set Onelink custom/branded domains
enableFacebookDeferredApplinks ({isEnabled}): Promise<void> support deferred deep linking from Facebook Ads
setUserEmail ({email}): Promise<void> Set a single user email for FB Advanced Matching
setUserPhone ({countryCode, phoneNumber}): Promise<void> Set phone number for FB Advanced Matching
setHost ({hostPrefixName, hostName}): Promise<void> Set custom host prefix and host name
addPushNotificationDeepLinkPath ({deepLinkPath}): Promise<void> configure push notification deep link resolution
setResolveDeepLinkURLs ({urls}): Promise<void> get the OneLink from click domains
setDisableSKAdNetwork ({disable}): Promise<void> disable or enable SKAdNetwork support
setCurrentDeviceLanguage ({language}): Promise<void> Set the language of the device.
setAdditionalData ({customData}): Promise<void> Allows you to add custom data to events sent from the SDK.
setPartnerData ({partnerId, data}): Promise<void> Allows sending custom data for partner integration purposes.
sendPushNotificationData ({campaign, pid, isRetargeting?, additionalParameters?}): Promise<void> Measure and get data from push-notification campaigns.
setDisableNetworkData ({isDisable}): Promise<void> Use to opt-out of collecting the network operator name (carrier) and sim operator name from the device.
setConsentData ({isUserSubjectToGDPR, hasConsentForDataUsage?, hasConsentForAdsPersonalization?, hasConsentForAdStorage?}): Promise<void> Set consent fields manually (e.g. by prompting user and collecting results).
enableTCFDataCollection ({shouldCollect}): Promise<void> instruct the SDK to collect the TCF data from the device.
logAdRevenue ({monetizationNetwork, mediationNetwork, currencyIso4217Code, revenue, additionalParameters?}): Promise<void> Log ad revenue event.
disableAppSetId (): Promise<void> Android only - Disables App Set ID collection (enabled by default)
registerConversionListener ({onConversionDataSuccess?, onConversionDataFail?}): Promise<void> Get conversion/attribution data, replacing the old onInstallConversionDataListener init flag
enableDebug ({enabled}): Promise<void> Toggle debug mode, replacing the old isDebug init flag
setUseUninstallSandbox ({sandbox}): Promise<void> iOS only - test uninstall in the Sandbox environment, replacing the old useUninstallSandbox init flag
setCollectAndroidID ({isCollect}): Promise<void> Android only - opt in/out of Android ID collection, replacing the old collectAndroidID init flag
setAndroidIdData ({androidId}): Promise<void> Android only. Explicitly set the Android ID
setImeiData ({imei}): Promise<void> Android only. Explicitly set the device IMEI
setOaidData ({oaid}): Promise<void> Android only. Explicitly set the Open Anonymous Device Identifier (OAID)

initialize the SDK. No longer implicitly starts tracking — see start below, which must be called from inside registerSessionReadyListener's callback. Client-side arg validation is gone; failures reject with AppsFlyerError/AppsFlyerRpcError.

parameter type description
params {devKey: string, appId?: string} SDK configuration

params

name type description
devKey string Appsflyer Dev key
appId string (optional) Apple Application ID (for iOS only)

Note: these old initSdk flags are gone from init's params — most moved to their own setter, called after init():

old initSdk flag replacement
isDebug enableDebug({enabled})
useUninstallSandbox setUseUninstallSandbox({sandbox})
collectAndroidID setCollectAndroidID({isCollect}) (or setAndroidIdData({androidId}) to pass manually)
onInstallConversionDataListener registerConversionListener
onDeepLinkListener registerDeepLinkListener
waitForATTUserAuthorization removed (no direct RPC equivalent; handle ATT via AppTrackingTransparency framework before start)
shouldStartSdk nothing to set; start is now always explicit via registerSessionReadyListener
collectIMEI automatic collection removed; use setImeiData({imei}) to pass the identifier manually

See Guides.md for the full init/start sequencing.

Example:

try {
  await window.plugins.appsFlyer.init({
    devKey: 'd3Ac9qPardVYZxfWmCspwL',
    appId: '123456789'
  });
} catch (err) {
  // handle error
}

Starts the SDK. Must be called from inside registerSessionReadyListener's callback per SDK 7's manual startup model — it is no longer called implicitly after init. See Guides.md for the full sequencing example.

parameter type description
params {awaitResponse?: boolean} (optional)

Example:

await window.plugins.appsFlyer.init({ devKey, appId });

await window.plugins.appsFlyer.registerSessionReadyListener(() => {
  window.plugins.appsFlyer.start();
});

Registers a callback for the session-ready event. start() must be called from inside this callback — see Guides.md.

parameter type description
onReady () => void called once the SDK session is ready to start

Registers a callback for conversion/attribution data, replacing the old onInstallConversionDataListener init flag. Call after init() — see Guides.md.

parameter type description
onConversionDataSuccess (data) => void (optional) called with the conversion data
onConversionDataFail (error) => void (optional) called if fetching conversion data fails

Toggles debug mode, replacing the old isDebug init flag.

parameter type description
enabled boolean whether debug logging is on

iOS only. Tests uninstall in the Sandbox environment, replacing the old useUninstallSandbox init flag.

parameter type description
sandbox boolean whether to use the Sandbox environment

Android only. Opts in/out of automatic Android ID collection, replacing the old collectAndroidID init flag. To pass a specific Android ID manually instead of having the SDK collect it, use setAndroidIdData.

parameter type description
isCollect boolean whether to collect the Android ID

  • 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 want to measure to allow you to track ROI (Return on Investment) and LTV (Lifetime Value).
  • The logEvent 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.
parameter type description
eventName string custom event name, is presented in your dashboard. See the in-app events overview
eventValues Object (optional) event details
awaitResponse boolean (optional)

Example:

try {
  await window.plugins.appsFlyer.logEvent({
    eventName: 'af_add_to_cart',
    eventValues: {
      'af_content_id': 'id123',
      'af_currency': 'USD',
      'af_revenue': '2'
    }
  });
} catch (err) {
  // handle error
}

End User Opt-Out (Optional)

AppsFlyer provides you a method to opt‐out specific users from AppsFlyer analytics. This method complies with the latest privacy requirements and complies with Facebook data and privacy policies. Default is FALSE, meaning tracking is enabled by default.

parameter type description
shouldAnonymize boolean

Examples:

await window.plugins.appsFlyer.anonymizeUser({ shouldAnonymize: true });

parameter type Default description
currencyCode string USD ISO 4217 Currency Codes

Examples:

await window.plugins.appsFlyer.setCurrencyCode({ currencyCode: 'USD' });
await window.plugins.appsFlyer.setCurrencyCode({ currencyCode: 'GBP' }); // British Pound

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
customerId string

Example:

await window.plugins.appsFlyer.setCustomerUserId({ customerId: userId });

parameter type description
shouldStop 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 shouldStop param. Once this API is invoked, our SDK will no longer communicate with our servers and stop functioning.

Example:

await window.plugins.appsFlyer.stop({ shouldStop: true });

In any event, the SDK can be reactivated by calling the same API, but passing shouldStop: false.


Registers the unified deep-link callback. This also covers what used to be the separate registerOnAppOpenAttribution API — that method was removed in 7.0 and folded into onDeepLinking here.

parameter type description
onDeepLinking (data: DeepLinkData) => void called after receiving deep link data. data.status is one of 'FOUND' | 'NOT_FOUND' | 'ERROR'.

Example:

await window.plugins.appsFlyer.registerDeepLinkListener({
  onDeepLinking: (data) => {
    console.log('AppsFlyer DDL ==> ' + JSON.stringify(data));
  }
});

(Android) Allows to pass GCM/FCM Tokens that where collected by third party plugins to the AppsFlyer server. Can be used for Uninstall Tracking.

parameter type description
token string GCM/FCM Token

Example:

await window.plugins.appsFlyer.updateServerUninstallToken({ token });

Get AppsFlyer’s proprietary Device ID. The AppsFlyer Device ID is the main ID used by AppsFlyer in Reports and APIs.

Example:

const uid = await window.plugins.appsFlyer.getAppsFlyerUID();

Set AppsFlyer’s OneLink ID. Setting a valid OneLink ID will result in shortened User Invite links, when one is generated. The OneLink ID can be obtained on the AppsFlyer Dashboard.

parameter type description
oneLinkId string OneLink ID

Example:

await window.plugins.appsFlyer.setAppInviteOneLink({ oneLinkId: 'Ab1C' });

Allowing your existing users to invite their friends and contacts as new users to your app can be a key growth factor for your app. AppsFlyer allows you to track and attribute new installs originating from user invites within your app.

parameter type description
parameters Object (optional) Parameters for the Invite link
awaitResponse boolean (optional)

Example:

try {
  const link = await window.plugins.appsFlyer.generateInviteLink({
    parameters: {
      channel: 'gmail',
      campaign: 'myCampaign',
      customerID: '1234',
      userParams: {
        myParam: 'newUser',
        anotherParam: 'fromWeb',
        amount: 1
      }
    }
  });
  console.log(link); // Handle Generated Link Here
} catch (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.


Use this call to track an impression use the following API call. Make sure to use the promoted App ID as it appears within the AppsFlyer dashboard.

parameter type description
appId string Promoted Application ID
campaign string (optional) Promoted Campaign
userParams Object (optional) Additional parameters to track

Example:

await window.plugins.appsFlyer.logCrossPromoteImpression({
  appId: 'com.myandroid.app',
  campaign: 'myCampaign'
});

For more details about Cross-Promotion tracking please see here.


Use this call to track the click and launch the app store's app page (via Browser)

parameter type description
promotedAppId string Promoted Application ID
campaign string (optional) Promoted Campaign
userParams Object (optional) Additional Parameters to track

Example:

await window.plugins.appsFlyer.logAndOpenStore({
  promotedAppId: 'com.myandroid.app',
  campaign: 'myCampaign',
  userParams: {
    customerID: '1234',
    myCustomParameter: 'newUser'
  }
});

For more details about Cross-Promotion tracking please see here.


Get the current SDK version

Example:

const version = await window.plugins.appsFlyer.getSdkVersion();

Used by advertisers to exclude specified networks/integrated partners from getting data. Learn more here

parameter type description
partners string[] | null Array of partners that need to be excluded. Pass null to exclude all partners.

Example:

let partners = ["facebook_int","googleadwords_int","snapchat_int","doubleclick_int"];

await window.plugins.appsFlyer.setSharingFilterForPartners({ partners });

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 here

📘Note

Before 7.0 this repo had two purchase-validation methods: a deprecated validateAndLogInAppPurchase (V1, raw receipt fields — publicKey/signature/purchaseData) and validateAndLogInAppPurchaseV2. In 7.0 the V1 raw-receipt shape is gone entirely, and this unqualified name is now V2's successor.

Generates an af_purchase in-app event upon successful validation. Sending this event yourself will cause duplicate event reporting.

parameter type description
purchase Object Purchase details — Android: {purchaseType, productId, purchaseToken}; iOS: {purchaseType, productId, transactionId}
additionalParameters Object (optional) Additional parameters to include with the purchase event

Purchase parameters:

parameter type description
purchaseType string "subscription" or "one_time_purchase" (see AFPurchaseType)
productId string The product identifier
purchaseToken string The purchase token from Google Play Store. Android only
transactionId string The purchase transaction Id. iOS only

Example:

try {
  const result = await window.plugins.appsFlyer.validateAndLogInAppPurchase({
    purchase: {
      purchaseType: window.plugins.appsFlyer.AFPurchaseType.subscription,
      productId: 'my-product-id',
      transactionId: '12345-transaction-id' // iOS; use purchaseToken on Android
    },
    additionalParameters: {
      custom_param_1: 'value1',
      custom_param_2: 'value2'
    }
  });
  console.log('Purchase validation successful:', result);
} catch (error) {
  console.log('Purchase validation failed:', error);
}

In app purchase receipt validation Apple environment(production or sandbox)

Example:

await window.plugins.appsFlyer.setUseReceiptValidationSandbox({ sandbox: true });
parameter type description
sandbox boolean true if In app purchase is done with sandbox

iOS ONLY
AppsFlyer SDK dynamically loads the Apple iAd.framework. This framework is required to record and measure the performance of Apple Search Ads in your app.
If you don't want AppsFlyer to dynamically load this framework, set this property to true.
Example:

await window.plugins.appsFlyer.setDisableCollectASA({ disable: true });
parameter type description
disable boolean If you don't want AppsFlyer to dynamically load iAd.framework, set this property to true

Disable collection of Apple, Google, Amazon and Open advertising ids (IDFA, GAID, AAID, OAID).
Example:

await window.plugins.appsFlyer.setDisableAdvertisingIdentifiers({ disable: true });
parameter type description
disable boolean Disable collection of Apple, Google, Amazon and Open advertising ids (IDFA, GAID, AAID, OAID).

Set Onelink custom/branded domains
Use this API during the SDK Initialization to indicate branded domains. For more information Learn here

Example:

let domains = ["promotion.greatapp.com", "click.greatapp.com", "deals.greatapp.com"];
await window.plugins.appsFlyer.setOneLinkCustomDomain({ domains });
parameter type description
domains string[] String array of branded domains

support deferred deep linking from Facebook Ads

NOTE: use this api before init.
For more information Learn here

Example:

await window.plugins.appsFlyer.enableFacebookDeferredApplinks({ isEnabled: true });
parameter type description
isEnabled boolean enable support deferred deep linking from Facebook Ads

Set a single user email for FB Advanced Matching. Callers previously passing multiple emails need to make one call per email.

Example:

await window.plugins.appsFlyer.setUserEmail({ email: 'foo@gmail.com' });
parameter type description
email string User email

Set phone number for FB Advanced Matching. Now also requires countryCode.

Example:

await window.plugins.appsFlyer.setUserPhone({ countryCode: '972', phoneNumber: '0548561587' });
parameter type description
countryCode string Country code
phoneNumber string Phone number

Set custom host prefix and host name

Example:

await window.plugins.appsFlyer.setHost({ hostPrefixName: 'another', hostName: 'host' });
parameter type description
hostPrefixName string host prefix
hostName string host name

The addPushNotificationDeepLinkPath method provides app owners with a flexible interface for configuring how deep links are extracted from push notification payloads. for more information: here ❗Important❗ addPushNotificationDeepLinkPath must be called before calling init

Example:

let deepLinkPath = ["go", "to", "this", "path"]
await window.plugins.appsFlyer.addPushNotificationDeepLinkPath({ deepLinkPath });
parameter type description
deepLinkPath string[] strings array of the path

Use this API to get the OneLink from click domains that launch the app. Make sure to call this API before SDK initialization.

Example:

let urls = ['clickdomain.com', 'anotherclickdomain.com'];
await window.plugins.appsFlyer.setResolveDeepLinkURLs({ urls });
parameter type description
urls string[] strings array of domains

enable or disable SKAdNetwork support. set disable: true if you want to disable it!
setDisableSKAdNetwork must be called before calling init and for iOS ONLY!.

Example:

await window.plugins.appsFlyer.setDisableSKAdNetwork({ disable: true });
parameter type description
disable boolean disable or enable SKAdNetwork support

Set the language of the device. The data will be displayed in Raw Data Reports
setCurrentDeviceLanguage must be called before calling init and for iOS ONLY!.

Example:

await window.plugins.appsFlyer.setCurrentDeviceLanguage({ language: 'en' });
parameter type description
language string Set the language of the device.

The setAdditionalData API allows you to add custom data to events sent from the SDK.
Typically it is used to integrate on the SDK level with several external partner platforms.

Example:

await window.plugins.appsFlyer.setAdditionalData({
  customData: {
    "aa": "cc",
    "af": "cordova",
    "ts": 195659889569,
    "revenue": 15
  }
});
parameter type description
customData Object Custom data to attach to events sent from the SDK.

Allows sending custom data for partner integration purposes.

Example:

await window.plugins.appsFlyer.setPartnerData({
  partnerId: "af_int",
  data: { apps: "Flyer", cuid: "123abc" }
});
parameter type description
partnerId string ID of the partner (usually suffixed with "_int").
data Object Customer data, depends on the integration configuration with the specific partner.

Measure and get data from push-notification campaigns. The old opaque pushData object is gone — the new schema requires specific fields.

Example:

await window.plugins.appsFlyer.sendPushNotificationData({
  campaign: "myCampaign",
  pid: "myMediaSource",
  isRetargeting: true,
  additionalParameters: { someKey: "Some Value" }
});
parameter type description
campaign string Campaign name
pid string Media source
isRetargeting boolean (optional)
additionalParameters Object (optional) Additional push-data fields

Use to opt-out of collecting the network operator name (carrier) and sim operator name from the device. Example:

await window.plugins.appsFlyer.setDisableNetworkData({ isDisable: true });
parameter type description
isDisable boolean If should opt out, default to false

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. params has 4 fields (pass a plain object — the AppsFlyerConsent class and its forGDPRUser/forNonGDPRUser factories were removed in 7.0):

parameter type description
isUserSubjectToGDPR boolean Indicates whether GDPR regulations apply to the user (true if the user is a subject of GDPR). It also serves as a flag for compliance with relevant aspects of DMA regulations.
hasConsentForDataUsage boolean|null (optional) Indicates whether the user has consented to use their data for advertising purposes. This can apply under GDPR, DMA, or other applicable privacy regulations.
hasConsentForAdsPersonalization boolean|null (optional) Indicates whether the user has consented to use their data for personalized advertising. This can apply under GDPR, DMA, or other applicable privacy regulations.
hasConsentForAdStorage boolean|null (optional) Indicates whether the user has provided consent for the storage of their advertising data. This can be relevant for GDPR, DMA, or other regulatory compliance purposes.

Example:

await window.plugins.appsFlyer.setConsentData({
  isUserSubjectToGDPR: true,
  hasConsentForDataUsage: true,
  hasConsentForAdsPersonalization: true,
  hasConsentForAdStorage: true
});

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

parameter type description
shouldCollect boolean enable/disable TCF data collection

Example:

await window.plugins.appsFlyer.enableTCFDataCollection({ shouldCollect: true });

log ad-revenue event. The fields that used to live in a nested adRevenueData object are now top-level params; additionalParameters moved from a second function argument into the same object.

parameter type description
monetizationNetwork string Monetization network name
mediationNetwork string Use the exported MediationNetwork constant rather than a literal; the plugin maps each value to the right native spelling per platform. Values: ironSource, applovinMax, googleAdMob, fyber, appodeal, admost, topon, tradplus, yandex, chartboost, unity, toponPte, customMediation, directMonetizationNetwork
currencyIso4217Code string Currency in ISO 4217 format
revenue number Revenue amount
additionalParameters Object (optional) additional Params Data map

Example:

await window.plugins.appsFlyer.logAdRevenue({
    monetizationNetwork: 'testMonetizationNetwork',
    mediationNetwork: window.plugins.appsFlyer.MediationNetwork.TOPON,
    currencyIso4217Code: 'USD',
    revenue: 15.0,
    additionalParameters: {
        'additionalKey1':'additionalValue1',
        'additionalKey2':'additionalValue2'
    }
});

By passing all the required fields, 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.

Disables App Set ID collection (enabled by default). Please look on App Set ID official documentation

Example:

await window.plugins.appsFlyer.disableAppSetId();

Android only. Explicitly sends the device Android ID (Settings.Secure.ANDROID_ID) to AppsFlyer.

By default, AppsFlyer doesn't collect the Android ID on devices running Android versions higher than KitKat (4.4) with Google Play Services. Call this method before start() if you need to attribute devices using their Android ID.

parameter type description
androidId string Device Android ID

Example:

await window.plugins.appsFlyer.setAndroidIdData({
  androidId: '4b3d7a8e9f012345'
});

Android only. Explicitly sends the device IMEI (International Mobile Equipment Identity) to AppsFlyer.

By default, AppsFlyer doesn't collect the IMEI on devices running Android versions higher than KitKat (4.4) with Google Play Services. Call this method before start() when your app targets app stores or regions where IMEI is required for attribution (such as domestic Chinese app stores).

parameter type description
imei string Device IMEI

Example:

await window.plugins.appsFlyer.setImeiData({
  imei: '356938035643803'
});

Android only. Explicitly sends the Open Anonymous Device Identifier (OAID) to AppsFlyer.

AppsFlyer doesn't collect the OAID automatically. Call this method before start() to attribute installs from third-party Android app stores such as Huawei AppGallery, Xiaomi GetApps, and OPPO App Market.

parameter type description
oaid string Device Open Anonymous Device Identifier (OAID)

Example:

await window.plugins.appsFlyer.setOaidData({
  oaid: 'a8d05200-22fb-4e66-9e8c-4a30e872e4b3'
});

iOS only. Forward a URL-scheme open to the SDK. See Deep linking Tracking below for the integration context.

parameter type description
url string The opened URL
options Object (optional) Open-URL options, if any

Example:

await window.plugins.appsFlyer.handleOpenUrl({ url });

iOS only. Case-variant of handleOpenUrl, kept as a distinct method for hand-integrated AppDelegates. Same param shape.

parameter type description
url string The opened URL
options Object (optional) Open-URL options, if any

Example:

await window.plugins.appsFlyer.handleOpenURL({ url });

In ver. >4.2.5 deeplinking metadata (scheme/host) is sent automatically

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:

await window.plugins.appsFlyer.handleOpenUrl({ url });

It appears as follows:

var handleOpenURL = async function(url) {
  await window.plugins.appsFlyer.handleOpenUrl({ url });
}

You will get the deep link information via registerDeepLinkListener's onDeepLinking callback.

To enable Universal Links in iOS please follow the guide here.

Note: Our plugin uses method swizzeling for
  • (BOOL)application:(UIApplication *)application

continueUserActivity:(NSUserActivity *)userActivity

restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler; `