appsflyer.*

Type Library
Revision Release 2024.3703
Keywords analytics, attribution, AppsFlyer
Platforms Android, iOS

Overview

The AppsFlyer is the world’s leading mobile attribution & marketing analytics platform, helping app marketers around the world make better decisions.

Important

Check out init parameter hasUserConsent and also setHasUserConsent method to enable GDPR data collection restrictions.

Registration

Before using this plugin, you’ll need to register with AppsFlyer to receive an app ID and Developer Key.

Important

According to Facebook’s privacy policy, AppsFlyer (or any other 3rd party mobile measurement partner) cannot provide user-level attribution for Facebook installs unless you accept Facebook’s Terms of Service. More info here.

If you choose not to accept the Terms of Service, Facebook Mobile Ads installs are categorized as ‘Organic’ and you are unable to receive the user level data for Facebook installs.

Syntax

local appsflyer = require( "plugin.appsflyer" )

Functions

appsflyer.init()

appsflyer.logEvent()

appsflyer.getVersion()

appsflyer.setHasUserConsent()

appsflyer.logPurchase()

appsflyer.getAppsFlyerUID()

Events

analyticsRequest

Project Settings

To use this plugin, add the following entry into the plugins table of build.settings. When added, the build server will integrate the plugin during the build phase.

settings =
{
    plugins =
    {
        ["plugin.appsflyer"] =
        {
            publisherId = "com.coronalabs"
        },
    },
}

Strict Mode

“Strict Mode SDK to completely remove IDFA collection functionality and AdSupport framework dependencies (for example, when developing apps for kids)”

To use strict mode for iOS include this in build.settings instead for the above. The strict mode version of the plugin include the regular plugin.appsflyer for Android so there is no need to include both plugins.

settings =
{
    plugins =
    {
        ["plugin.appsflyer.strict"] =
        {
            publisherId = "com.coronalabs"
        },
    },
}

Lastly you need to tweak the module name for require function

local appsflyer = require( "plugin.appsflyer.strict" )
Important

For iOS, when submitting your app to the App Store, follow these guidelines:

  • Make sure you select yes when asked if your app uses the Advertising Identifier (IDFA).
  • Ensure that the Attribute this app installation to previously served advertisement box is checked.
  • For installs from iOS to be counted, the app must be installed from the Apple App Store.
Note

For Android, the following permissions/features are automatically added when using this plugin:

  • "android.permission.INTERNET"
  • "android.permission.ACCESS_NETWORK_STATE"
  • "android.permission.ACCESS_WIFI_STATE"
  • "com.google.android.gms.permission.AD_ID"

To remove "com.google.android.gms.permission.AD_ID" add the following to you build.settings

settings =
{
    android =
    {
        manifestChildElements =
        {
            [[
            <uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
            ]],
        },
    },
}