Type Function Return value Boolean Revision 2017.3060 Keywords ads, advertising, Facebook Audience Network, fbAudienceNetwork, isLoaded See also fbAudienceNetwork.show() fbAudienceNetwork.*
Checks to see if a Facebook ad is already loaded. Returns true
if an ad is loaded/ready, otherwise returns false
.
fbAudienceNetwork.isLoaded( placementID )
String. The placement ID for the 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 ) -- Sometime later, check if the ad is loaded and display it if ( fbAudienceNetwork.isLoaded( myPlacementID ) ) then fbAudienceNetwork.show( "banner", { placementId=myPlacementID } ) end