At a glance: Technical descriptions of classes and methods included in the AppsFlyer SDK.
Related reading
For a complete picture of integrating the Unity plugin with your apps, be sure to read these articles:
- Unity plugin V6 integration guide—Overview
- Unity plugin V6 integration guide—Basic SDK integration
- Unity plugin V6 integration guide—Additional SDK integration
- Unity plugin V6 integration guide—API reference (this article)
Android and iOS APIs
initSDK
Description |
Initialize the plugin with the dev key and app ID. The dev key is required for all app. The app ID is required for iOS only. If your app is for Android only, pass null for the app ID. The game object contains the IAppsFlyerConversionData interface. |
Method signature |
|
Example |
|
startSDK
Description |
Once this API is invoked, the SDK will start, sessions will be immediately sent, and all background foreground transitions will record a session. |
Method signature |
|
Example |
|
sendEvent
Description |
Recording of in-app events is performed by calling sendEvent with the event name and value parameters. |
Method signature |
|
Example |
|
stopSDK
Description |
In some extreme cases, you might want to shut down all SDK functions for regulators and privacy compliance requirements. To do so use stopSDK API. Once invoked, the SDK no longer communicates with AppsFLyer servers and stops functioning. |
Method signature |
|
Example |
|
isSDKStopped
Description |
Was the stopSDK (boolean) API set to true. |
Method signature |
bool isSDKStopped() |
Example |
|
getSdkVersion
Description |
Get the AppsFlyer SDK version |
Method signature |
|
Example |
|
setIsDebug
Description |
Enables debug logs |
Method signature |
|
Example |
|
setCustomerUserID
Description |
Set the customer user ID (CUID). |
Method signature |
|
Example |
|
setAppInviteOneLink
Description |
Set the OneLink template ID used to create custom attribution links for user invites. |
Method signature |
|
Example |
|
setAdditionalData
Description |
Add additional data to send to external partner platforms. |
Method signature |
|
Example |
|
setResolveDeepLinkURLs
Description |
Resolve OneLink from click domains. Learn more about resolving wrapped deep link URLs. |
Method signature |
|
Example |
|
setOneLinkCustomDomain
Description |
Advertisers can use this method to set vanity OneLink domains. |
Method signature |
|
Example |
|
setcurrencyCode
Description |
Use for events with revenue. Accepts ISO currency codes. |
Method signature |
|
Example |
|
recordLocation
Description |
Manually record user location |
Method signature |
|
Example |
|
anonymizeUser
Description |
Use during initialization to explicitly anonymize the user install, events, and sessions. To stop anonymizing, call anonymizeUser again, set to false. |
Method signature |
|
Example |
|
getAppsFlyerId
Description |
To get the AppsFlyer Unique ID for a new install. |
Method signature |
|
Example |
|
setMinTimeBetweenSessions
Description |
By default, at least 5 seconds must elapse between 2 app launches to count as separate sessions. Set a custom value for the minimum required time between sessions. |
Method signature |
|
Example |
|
setUserEmails
Description |
Set user emails and encrypt them. |
Method signature |
|
Example |
|
setHost
Description |
Set a custom host |
Method signature |
|
Example |
|
getConversionData
Description |
Register a conversion data listener to allow access to user attribution data in real-time for every new install, directly from the SDK level. By doing so, serve users with personalized content or send them to specific activities within the app, which can significantly enhance their engagement with your app. |
Method signature |
|
Example |
|
attributeAndOpenStore
Description |
To attribute the click and launch the app store app page. |
Method signature |
|
Example |
|
recordCrossPromoteImpression
Description |
To attribute an impression, use the following API call. Make sure to use the promoted App ID as it appears within the AppsFlyer dashboard. |
Method signature |
|
Example |
|
generateUserInviteLink
Description |
The LinkGenerator class builds the invite URL according to various setter methods, which allow passing on additional information on the click. |
Method signature |
|
Example |
|
onAppOpenAttribution
Description |
Get deep-link data when an app opens via a deep link. |
Method signature |
|
Example |
|
onAppOpenAttributionFailure
Description |
Obtains errors while getting deep-link data. |
Method signature |
|
Example |
|
onConversionDataSuccess
Description |
Method used to get conversion data. Useful for deferred deep linking. Learn more.
|
Method signature |
|
Example |
|
onConversionDataFail
Description |
Handles errors when failing to get conversion data from installs. |
Method signature |
|
Example |
|
onInviteLinkGenerated
Description |
Success callback for generating OneLink URLs. |
Method signature |
|
Example |
|
onInviteLinkGeneratedFailure
Description |
Error callback for generating OneLink URLs. |
Method signature |
|
Example |
|
didFinishValidateReceipt
Description |
Success callback for validateAndSendInAppPurchase API. For Android: Callback returns "Validate success". |
Method signature |
|
Example |
|
didFinishValidateReceiptWithError
Description |
Error callback for validating receipts. |
Method signature |
|
Example |
|
setPhoneNumber
Description |
Used to set the user phone number. |
Method signature |
|
Example |
|
setSharingFilterForAllPartners
Description |
Used by advertisers to exclude all networks/integrated partners from getting data. Learn more |
Method signature |
|
Example |
|
setSharingFilter
Description |
Used by advertisers to set some (one or more) networks/integrated partners to exclude from getting data. Learn more |
Method signature |
|
Example |
|
Android APIs
updateServerUninstallToken
Description |
Manually pass the Firebase Device Token for uninstall measurement. |
Method signature |
|
Example |
|
setImeiData
Description |
To explicitly send the IMEI to AppsFlyer. |
Method signature |
|
Example |
|
setAndroidIdData
Description |
To explicitly send Android ID to AppsFlyer. |
Method signature |
|
Example |
|
waitForCustomerUserId
Description |
This feature makes sure that the SDK doesn't begin functioning until the customer user ID is provided. |
Method signature |
|
Example |
|
setCustomerIdAndStartSDK
Description |
To provide the SDK with the relevant customer user ID and trigger the SDK to begin its normal activity. |
Method signature |
|
Example |
|
getOutOfStore
Description |
Get the current AF_STORE value. |
Method signature |
|
Example |
|
setOutOfStore
Description |
Manually set the AF_STORE value. |
Method signature |
|
Example |
|
setCollectAndroidID
Description |
Opt-out of Android ID collection. 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 violates the Google Play policy. |
Method signature |
|
Example |
|
setCollectIMEI
Description |
Opt-out of IMEI collection. If the app does NOT contain Google Play Services, device IMEI is collected by the plugin. However, apps with Google play services should avoid IMEI collection as this violates the Google Play policy. |
Method signature |
|
Example |
|
setIsUpdate
Description |
Manually set that the application was updated. |
Method signature |
|
Example |
|
setPreinstallAttribution
Description |
Specify the manufacturer or media source name to which the pre-install is attributed. |
Method signature |
|
Example |
|
isPreInstalledApp
Description |
Boolean indicator for pre-install by the manufacturer. |
Method signature |
|
Example |
|
getAttributionId
Description |
Get the Facebook attribution ID, if one exists. |
Method signature |
|
Example |
|
handlePushNotifications
Description |
Get push notifications recorded. |
Method signature |
|
Example |
|
validateAndSendInAppPurchase
Description |
API for server verification of in-app purchases. An af_purchase event with the relevant values will be automatically sent if the validation is successful. |
Method signature |
|
Example |
|
iOS APIs
setShouldCollectDeviceName
Description |
Set this flag to true, to collect the current device name (for example, "My iPhone"). The default value is "false". |
Method signature |
|
Example |
|
setDisableCollectIAd
Description |
Opt-out for Apple Search Ads attributions. |
Method signature |
|
Example |
|
setUseReceiptValidationSandbox
Description |
In-app purchase receipt validation in Apple environment (production or sandbox). The default value is "false". |
Method signature |
|
Example |
|
setUseUninstallSandbox
Description |
Set this flag to test uninstall in Apple environment (production or sandbox). The default value is "false". |
Method signature |
|
Example |
|
validateAndSendInAppPurchase
Description |
To send and validate in-app purchases, call this method from the processPurchase method. |
Method signature |
|
Example |
|
registerUninstall
Description |
Register for remote notification and provide AppsFlyer the push device token. |
Method signature |
|
Example |
|
handleOpenUrl
Description |
Used to manually record deep linking. |
Method signature |
|
Example |
|
onOpenStoreLinkGenerated
Description |
Allows you to utilize the StoreKit component to open the App Store while remaining in the context of your app. Learn more. |
Method signature |
|
Example |
|
disableSKAdNetwork
Description |
Allows you to disable SKAdNetwork attribution. Set to "true" to disable. |
Method signature |
|
Example |
|
waitForATTUserAuthorizationWithTimeoutInterval
Description |
Used if you want to request user authorization via a popup before accessing app-related data for recording the user or the device (for example, IDFA). If the user opts-in, the IDFA will be passed to the SDK. The timeout interval gives the user a set amount of time to opt-in to IDFA collection. After the timer expires, the IDFA is not collected. |
Method signature |
|
Example |
|