appsflyer.init()

Type Function
Return value none
Revision Release 2024.3703
Keywords analytics, attribution, AppsFlyer, init
See also appsflyer.*

Overview

appsflyer.init() initializes the AppsFlyer SDK.

Once initialized, you can call any of the other AppsFlyer API functions such as appsflyer.logEvent().

Syntax

appsflyer.init( listener, params )
listener (required)

Listener. Listener that will receive analyticsRequest events.

params (required)

Table. Table containing AppsFlyer initialization values — see the next section for details.

Parameter Reference

The params table includes parameters for the AppsFlyer initialization.

appID (required)

String. Your AppsFlyer App GUID, gathered from the AppsFlyer system. Note that you need to set the app ID here with digits only, without the id prefix.

devKey (required)

String. Your AppsFlyer Developer Key, gathered from the AppsFlyer system.

enableDebugLogging (optional)

Boolean. Debug logging will display extra information in the device log for easier troubleshooting. Default is false.

hasUserConsent (optional)

Boolean. To ease work with GDPR compliance of your app, change this init parameter to the needed value. If set to false, AppsFlyer will enable GDPR data collection restrictions, set to true for opposite. Default is false.

Example

local appsflyer = require( "plugin.appsflyer" )

local function appsflyerListener( event )
    -- Handle events here
end

-- Initialize plugin
appsflyer.init( appsflyerListener,
    {
        appID = "YOUR_APP_ID",
       devKey = "YOUR_DEV_KEY",
        enableDebugLogging = true,
       hasUserConsent = true
    }
)