Type Function Return value none Revision 2017.3060 Keywords ads, advertising, Facebook Audience Network, fbAudienceNetwork, load See also fbAudienceNetwork.show() fbAudienceNetwork.isLoaded() fbAudienceNetwork.*
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 )
String. The type of ad according to your Facebook placement ID. Supported values are "banner"
or "interstitial"
.
Table. Table containing additional parameters for the specified ad type — see the next section for details.
The params
table includes parameters for the specified ad type.
String. The placement ID for this ad, retrieved from the Facebook Developer Portal.
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 ) end end -- Initialize the Facebook Audience Network fbAudienceNetwork.init( adListener )