Type Function Return value none Revision 2017.3060 Keywords ads, advertising, Facebook Audience Network, fbAudienceNetwork, hide See also fbAudienceNetwork.show() fbAudienceNetwork.*
Hides a currently displayed Facebook ad.
fbAudienceNetwork.hide( placementID )
String. The placement ID for the currently displayed ad, retrieved from the Facebook Developer Portal.
local fbAudienceNetwork = require( "plugin.fbAudienceNetwork" ) -- Pre-declare a placement ID local myPlacementID = "YOUR_BANNER_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, show the banner ad if ( fbAudienceNetwork.isLoaded( myPlacementID ) ) then fbAudienceNetwork.show( "banner", { placementId=myPlacementID } ) end -- Sometime after showing the banner ad, hide it fbAudienceNetwork.hide( myPlacementID )