applovinMax.load()

Type Function
Return value none
Revision Release 2024.3703
Keywords ads, advertising, AppLovin, Applovin Max, load
See also applovinMax.show()
applovinMax.isLoaded()
applovinMax.*

Overview

Preloads a AppLovin ad. You can also call applovinMax.isLoaded() to verify that the ad has been loaded and applovinMax.show() to show it.

Syntax

applovinMax.load( adType )
adType (required)

String. One of the following values:

  • "banner"
  • "interstitial"
  • "rewardedVideo"
Notes
  • When you use "interstitial", both static interstitial ads and video interstitial ads may be loaded. You configure the type of ads to be used in the AppLovin developer portal.

  • You must enable “Rewarded Video” in the AppLovin developer portal to receive rewarded videos in your app.

  • Rewarded video offers can be limited to a certain amount in a given day, defined under “frequency capping” in the AppLovin developer portal.

params (required)

Table. Table containing AppLovin ad loading options.

Parameter Reference

The params table includes parameters for the AppLovin ad loading.

iOSUnitId ~^(required for iOS)^~

String. iOS Ad Unit ID, found in AppLovin developer portal under Manage > Ad Units.

androidUnitId ~^(required for android)^~

String. Android Ad Unit ID, found in AppLovin developer portal under Manage > Ad Units.

bannerSize (optional)

String. Valid values: "standard" (typically 320 x 50), "leader" (typically 768 x 90) and "mrec" (typically 320 x 250). Default is "standard".

Example

local applovin = require( "plugin.applovin" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.isError )
        -- Load an AppLovin ad
        applovin.load( "interstitial", {iOSUnitId ="replace with your own", androidUnitId="replace with your own"})

    elseif ( event.phase == "loaded" ) then  -- The ad was successfully loaded
        print( event.type )

    elseif ( event.phase == "failed" ) then  -- The ad failed to load
        print( event.type )
        print( event.isError )
        print( event.response )
    end
end

-- Initialize the AppLovin plugin
applovin.init( adListener )