Type Function
Return value none
Revision Current Public Release (2018.3326)
Keywords ads, advertising, InMobi, show
See also inMobi.hide()


Shows an InMobi ad which was previously loaded via inMobi.load().

Syntax placementID [, params] )
placementID (required)

String. The placement ID for the ad, retrieved from the InMobi developer portal. This is a numeric string and is listed in the InMobi developer portal under the label "Placement ID".

params (optional)

Table. Table containing positioning parameters for banner ads — see the next section for details.

Parameter Reference

The params table can include properties for positioning a banner ad. This does not apply to interstitial ads.

yAlign (optional)

String. Vertical alignment of the banner. Valid options are "top", "center", or "bottom". Default is "top".


local inMobi = require( "plugin.inMobi" )

-- Pre-declare a placement ID
local placementID = "PLACEMENT_ID"

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        -- Load a banner ad
        inMobi.load( "banner", placementID )

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

-- Initialize the InMobi plugin
inMobi.init( adListener, { accountId="YOUR_ACCOUNT_ID" } )

-- Sometime later, check if the ad is loaded
if ( inMobi.isLoaded( placementID ) ) then
    -- Show the ad placementID, { yAlign="bottom" } )