Skip to content

@capgo/capacitor-appsflyer

Capacitor plugin for AppsFlyer attribution, analytics, and deep links.

Capacitor plugin for AppsFlyer attribution, analytics, and deep links.

  • initSDK - Use this method to initialize and start AppsFlyer SDK. This API should be called as soon as the app launched.
  • startSDK - Use this method to start AppsFlyer SDK, only on manual start mode.
  • logEvent - Log an in-app event.
  • setCustomerUserId - Setting your own customer ID enables you to cross-reference your own unique ID with AppsFlyer’s unique ID and other devices’ IDs. This ID is available in raw-data reports and in the Postback APIs for cross-referencing with your internal IDs.
MethodDescription
addListener('conversion_callback', listener)Listen for conversion callbacks, including onConversionDataSuccess and onConversionDataFail, with OnConversionDataResult payloads.
addListener('oaoa_callback', listener)Listen for app-open attribution callbacks, including onAppOpenAttribution and onAttributionFailure, with OnAppOpenAttribution payloads.
addListener('udl_callback', listener)Listen for unified deep link callbacks with OnDeepLink payloads.
initSDKUse this method to initialize and start AppsFlyer SDK. This API should be called as soon as the app launched.
startSDKUse this method to start AppsFlyer SDK, only on manual start mode.
logEventLog an in-app event.
setCustomerUserIdSetting your own customer ID enables you to cross-reference your own unique ID with AppsFlyer’s unique ID and other devices’ IDs. This ID is available in raw-data reports and in the Postback APIs for cross-referencing with your internal IDs.
setCurrencyCodeSets the currency used for in-app purchases. Provide a three-character ISO 4217 code.
updateServerUninstallTokenPass GCM/FCM tokens on Android or APNs tokens on iOS when another plugin collected them. Use this to forward uninstall measurement tokens to AppsFlyer.
setAppInviteOneLinkSets the OneLink ID used as the base link for invite attribution.
setOneLinkCustomDomainRegisters branded OneLink domains so AppsFlyer can resolve attribution parameters hidden in short links.
appendParametersToDeepLinkingURLEnables attribution for App Links deep links without OneLink. Call this method before startSDK(). Include at least pid and is_retargeting=true in the parameters map.
setResolveDeepLinkURLsUse this when an AppsFlyer OneLink is wrapped inside another Universal Link. It lets the SDK resolve the wrapped URL so deep linking still works correctly.
addPushNotificationDeepLinkPathConfigures how the SDK extracts deep link values from push notification payloads.
setSharingFilterStops events from propagating to the specified AppsFlyer partners.
setSharingFilterForAllPartnersStops events from propagating to all AppsFlyer partners. Overwrites setSharingFilter.
setSharingFilterForPartnersStops events from propagating to the specified AppsFlyer partners.
setAdditionalDataSets additional key-value data to send to AppsFlyer.
getAppsFlyerUIDGet AppsFlyer’s unique device ID (created for every new install of an app).
anonymizeUserEnd User Opt-Out from AppsFlyer analytics (Anonymize user data).
stopOnce this API is invoked, our SDK no longer communicates with our servers and stops functioning. Useful when implementing user opt-in/opt-out.
disableSKAdNetworkOpt-out of SKAdNetwork.
disableAdvertisingIdentifierDisables collection of various Advertising IDs by the SDK. This includes Apple Identity for Advertisers (IDFA), Google Advertising ID (GAID), OAID and Amazon Advertising ID (AAID).
disableCollectASAOpt-out of Apple Search Ads attributions.
setHostSet a custom host.
generateInviteLinkAllowing your existing users to invite their friends and contacts as new users to your app.
validateAndLogInAppPurchaseAndroidAPI for server verification of in-app purchases. An af_purchase event with the relevant values will be automatically logged if the validation is successful.
validateAndLogInAppPurchaseIosSee the source definitions for current behavior.
getSdkVersionGet the AppsFlyer SDK version used in app.
enableFacebookDeferredApplinksEnable the collection of Facebook Deferred AppLinks. Requires Facebook SDK and Facebook app on target/client device. This API must be invoked before initializing the AppsFlyer SDK in order to function properly.
sendPushNotificationDataMeasure and get data from push-notification campaigns.
setCurrentDeviceLanguageSet the language of the device. The data will be displayed in Raw Data Reports.
logCrossPromoteImpressionLogs an impression as part of a cross-promotion campaign. Make sure to use the promoted app ID as it appears in the AppsFlyer dashboard.
setUserEmailsSet the user emails and encrypt them.
logLocationManually log the location of the user.
setPhoneNumberWill be sent as an SHA-256 encrypted string.
setPartnerDataAllows sending custom data for partner integration purposes.
logInviteUse to log a user-invite in-app event (af_invite).
setDisableNetworkDataUse to opt-out of collecting the network operator name (carrier) and sim operator name from the device.
enableTCFDataCollectionUse to opt-in/out the automatic collection of consent data, for users who use a CMP. Flag value will be persisted between app sessions.
setConsentDataUse this to set user consent data manually. If your app doesn’t use a CMP compatible with TCF v2.2, use the following method to manually provide the consent data directly to the SDK.
logAdRevenueBy 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. You can use this method to log your ad revenue.
setConsentDataV2Use this to set user consent data manually. If your app doesn’t use a CMP compatible with TCF v2.2, use the following method to manually provide the consent data directly to the SDK.
isSDKStartedUse this method to check whether the AppsFlyer SDK has already been started in the current session.
isSDKStoppedUse this method to check whether the AppsFlyer SDK is currently stopped.
disableAppSetIdDisables AppSet ID collection. If called before SDK init, App Set ID will not be collected. If called after init, App Set ID will be collected but not sent in request payloads. Android only.
validateAndLogInAppPurchaseV2API for server verification of in-app purchases V2. An af_purchase event with the relevant values will be automatically logged if the validation is successful.

This reference is synced from src/definitions.ts in capacitor-appsflyer.