API reference

Table of contents

Configure

Perform internal setup: inject plugin & engine version, read developer keys from Project Settings.
See here for configuration details.

C++

static void configure();

Start

  • Starts the SDK and sends the session to the server.
  • By default, the start method is called automatically once the app is being launched.
  • This setting can be disabled in the Plugin settings, to let the app developer manually control when the SDK starts. See here for more details.
  • If the Plugin is configured for a manual start, the developer should call the start method under the blueprint, and configure it to be called every foreground-background transition.

Blueprint:

C++

static void start();

Log Event

The logEvent method allows you to send in-app events to AppsFlyer.
For more information about defining in-app events, see here.

Blueprint:

C++

static void logEvent(FString eventName,
                     TMap<FString,FString> values);
  • eventName – canonical AppsFlyer event code, e.g. "af_purchase".
  • values – key/values payload (UTF‑8).
    Special handling: on iOS the helper converts "af_revenue" string to NSNumber so you may pass "4.99" without casting.

Get AppsFlyerUID

Retrieve the AppsFlyer ID (unique installation Id) from the SDK.

Blueprint

C++

static FString getAppsFlyerUID();

waitForATTUserAuthorizationWithTimeoutInterval

iOS 14+ utility that defers start() until user responds to the ATT prompt or the timeout elapses.
See more information about this API here.

IMPORTANT: When using this API, please perform the following:

  1. Set the Automatically start the AppsFlyer SDK flag under the plugin setting to false.
  2. Call the Set Custom User ID API before the call to the Start API.

Blueprint:

C++

static void waitForATTUserAuthorizationWithTimeoutInterval(int timeoutSeconds);

Set Customer User ID

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 postback APIs for cross-referencing with your internal IDs.

IMPORTANT: To set the user ID in the first SDK session, please perform the following:

  1. Set the Automatically start the AppsFlyer SDK flag under the plugin setting to false.
  2. Call the Set Custom User ID API before the call to the Start API.

Blueprint:

C++

static void setCustomerUserId(FString customerUserId);

Set Consent Data

As part of the EU Digital Marketing Act (DMA) legislation, big tech companies must get consent from European end users before using personal data from third-party services for advertising.

To comply with the legislation, Google requires AppsFlyer customers to include specific consent fields when sending events originating from EU end-users to Google.

If the app collects consent information from users manually, and not via a CMP, it should use the SetConsentData API and pass the following parameters:

  • isUserSubjectToGDPR - Indicates whether GDPR applies to the user.
  • hasConsentForDataUsage - Indicates whether the user has consented to use their data for advertising purposes.
  • hasConsentForAdsPersonalization - Indicates whether the user has consented to use their data for personalized advertising.
  • hasConsentForAdStorage - indicates whether the user has consented to store or access information on a device.

These parameters can either be preset by the developer or be set as parameters based on the end user's response.

Blueprint:

C++

// Option 1 - Use `ValueUnset` to omit a flag
static void SetConsentData(
    EAFBooleanState IsUserSubjectToGDPR,
    EAFBooleanState HasConsentForDataUsage,
    EAFBooleanState HasConsentForAdsPersonalization,
    EAFBooleanState HasConsentForAdStorage);

// Option 2 - C++ only
static void SetConsentDataTOptional(
    TOptional<bool> IsUserSubjectToGDPR,
    TOptional<bool> HasConsentForDataUsage,
    TOptional<bool> HasConsentForAdsPersonalization,
    TOptional<bool> HasConsentForAdStorage);

Uninstall Measurement

AppsFlyer uses silent push notifications, once a day, to verify if an app is still installed on a given device. If there is no response, an uninstall is recorded, and attributed to the media source that originally brought the user.

First, please make sure to read the relevant information about the uninstall feature in the AppsFlyer dashboard

iOS Uninstall

Important!
To support remote notifications in iOS follow the official unreal docs. Don't forget to download, compile, and run the Unreal Engine from the source.

Blueprint:

  1. After Unreal Engine is running, open the Unreal IDE, go to Settings > Platforms -> iOS, and check Enable Remote Notification Support.

  2. Under the setting -> Maps & Mods -> Game instance -> change the instance class to PlatformGameInstance

  3. Configure the nodes under the relevant blueprint:

    • Register for remote notification Will show a pop-up to the user from the OS, asking permission for remote notification
    • The application registered for remote notifications delegate** call AppsFlyer uninstall API from iOS lifecycle
    • AppsFlyerSDK remote notification token call AppsFlyer API for sending the token.

C++

static void setRemoteNotificationsToken(const TArray<uint8>& token);

Registers the device push‑token with AppsFlyer to enable uninstall measurement.

Debugging

When debugging, enable AppsFlyer debug logs and check for the Register endpoint

Android Uninstall

Complete the steps in the following article

  1. Configure Firebase cloud messaging

  2. Follow the app integration steps in this article.

  3. Use the appsFlyer.FirebaseMessagingServiceListener service, embedded in the SDK. This service extends the FirebaseFirebaseMessagingService class, used for receiving the FCM Device Token:

    <application
       <!-- ... -->
          <service
            android:name="com.appsflyer.FirebaseMessagingServiceListener">
            <intent-filter>
              <action android:name="com.google.firebase.MESSAGING_EVENT"/>
            </intent-filter>
          </service>
       <!-- ... -->
    </application>
    
    

Blueprint:

The same nodes as in iOS could be used for Android under the relevant blueprint. No API call is needed.

Set Additional Data

Add custom key-value pairs to the payload of the install event and any in-app event. The values will appear in raw-data reports.

IMPORTANT To include the additional data in the first SDK session, perform the following:

  1. Set the Automatically start the AppsFlyer SDK under the plugin setting to false.
  2. Call the setAdditionalData API before the call to the start API

Blueprint:

C++

static void setAdditionalData(TMap<FString,FString> customData);