Type Function Return value none Revision 2017.3060 Keywords ads, advertising, Supersonic, load See also supersonic.show() supersonic.isLoaded() supersonic.*
Preloads a Supersonic ad. You can also call supersonic.isLoaded() to verify that the ad has been loaded and supersonic.show() to show it.
supersonic.load( adUnitType, userId )
String. The type of ad you wish to load. Supported values are "offerWall"
, "interstitial"
, or "rewardedVideo"
.
String. The user id for the current user of your app. This can be any string value, for instance "user123"
.
local supersonic = require( "plugin.supersonic" ) local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization -- Load an offer wall ad supersonic.load( "offerWall", "user2546" ) 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 the Supersonic plugin supersonic.init( adListener, { appKey="YOUR_APP_KEY" } )