supersonic.show()

Type Function
Return value none
Revision Release 2022.3683
Keywords ads, advertising, Supersonic, show
See also supersonic.init()
supersonic.load()
supersonic.isLoaded()
supersonic.*

Overview

Shows an Supersonic ad which was previously loaded via supersonic.load().

Syntax

supersonic.show( adUnitType )
adUnitType (required)

String. The type of ad you wish to show. Supported values are "offerWall", "interstitial", or "rewardedVideo".

Example

local supersonic = require( "plugin.supersonic" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        -- Load an offer wall ad
        supersonic.load( "offerWall", "user2353" )

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

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

-- Initialize the Supersonic plugin
supersonic.init( adListener, { appKey="YOUR_APP_KEY" } )