mediaBrix.load()

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

Overview

Preloads a MediaBrix ad. You can also call mediaBrix.isLoaded() to verify that the ad has been loaded and mediaBrix.show() to show it.

Syntax

mediaBrix.load( placementId )
placementId (required)

String. The placement ID of the ad you want to load. 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 )

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

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