mediaBrix.show()

Type Function
Return value none
Revision 2018.3353
Keywords ads, advertising, MediaBrix, show
See also mediaBrix.init()
mediaBrix.load()
mediaBrix.isLoaded()
mediaBrix.*

Overview

Shows a MediaBrix ad which was previously loaded via mediaBrix.load().

Syntax

mediaBrix.show( placementId )
placementId (required)

String. The placement ID of the ad you want to show. This will be sent to you following completion of the MediaBrix registration process.

Example

local mediaBrix = require( "plugin.mediaBrix" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.isError )
        -- Load a MediaBrix ad
        mediaBrix.load( "PLACEMENT_ID" )

    elseif ( event.phase == "loaded" ) then  -- The ad was successfully loaded
        print( event.type )
        -- Show the ad
        mediaBrix.show( "PLACEMENT_ID" )

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

    elseif ( event.phase == "displayed" ) then  -- The ad was displayed
        print( event.type )

    elseif ( event.phase == "closed" ) then  -- The ad was closed
        print( event.type )
    end
end

-- Initialize MediaBrix
mediaBrix.init( adListener, { appId="YOUR_APP_ID" } )