supersonic.init()

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

Overview

supersonic.init() initializes the Supersonic plugin.

Once initialized, you can load an ad using supersonic.load() and subsequently show it via supersonic.show().

Syntax

supersonic.init( adListener, params )
adListener (required)

Listener. Listener function that will receive adsRequest events.

params (required)

Table. Table containing Supersonic initialization values — see the next section for details.

Parameter Reference

The params table includes initialization properties for the Supersonic plugin.

appKey (required)

String. Your Supersonic app key, retrieved from the Supersonic developer portal.

hasUserConsent (optional)

Boolean. If set to false, Chartboost will enable GDPR data collection restrictions, set to true for opposite. Default is false.

Example

local supersonic = require( "plugin.supersonic" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.isError )
    end
end

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