applovin.init()

Type Function
Return value none
Revision Release 2024.3703
Keywords ads, advertising, AppLovin, init
See also applovin.load()
applovin.show()
applovin.*

Overview

applovin.init() initializes the AppLovin plugin.

Once initialized, you can load an ad using applovin.load() and subsequently show it via applovin.show().

Note

This call requires your AppLovin SDK key, obtained from the AppLovin developer portal. From the Account section, expand the Account menu on the left side, select Keys, and your SDK key should be revealed.

Syntax

applovin.init( adListener, params )
adListener (required)

Listener. Listener function that will receive adsRequest events.

params (required)

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

Parameter Reference

The params table includes parameters for the AppLovin initialization.

sdkKey (required)

String. Your SDK key from AppLovin, found within the AppLovin developer portal.

verboseLogging (optional)

Boolean. Set this to true to output AppLovin logs to the console.

testMode (optional)

Boolean. Set this to true to enable test mode. When true, test mode will take immediate effect and this will override the test mode setting in the AppLovin developer portal.

Example

local applovin = require( "plugin.applovin" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.isError )
    end
end

-- Initialize the AppLovin plugin
applovin.init( adListener, { sdkKey="YOUR_SDK_KEY" } )