Type Function
Return value none
Revision Release 2021.3646
Keywords ads, advertising, Facebook Audience Network, fbAudienceNetwork, load
See also fbAudienceNetwork.show()


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


fbAudienceNetwork.load( adUnitType, params )
adUnitType (required)

String. The type of ad according to your Facebook placement ID. Supported values are "banner", "rewardedVideo" or "interstitial".

params (required)

Table. Table containing additional parameters for the specified ad type — see the next section for details.

Parameter Reference

The params table includes parameters for the specified ad type.

placementId (required)

String. The placement ID for this ad, retrieved from the Facebook Developer Portal.

bannerSize (optional)

String. The banner ad size to load (does not apply to interstitial ads). Supported values include:

  • "BANNER_320_50"


local fbAudienceNetwork = require( "plugin.fbAudienceNetwork" )

-- Pre-declare a placement ID
local myPlacementID = "YOUR_PLACEMENT_ID"

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        -- Load a banner ad
        fbAudienceNetwork.load( "banner", { placementId=myPlacementID, bannerSize="BANNER_HEIGHT_50" } )

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

-- Initialize the Facebook Audience Network
fbAudienceNetwork.init( adListener )