chartboost.init()

Type Function
Return value none
Revision 2017.3060
Keywords ads, advertising, Chartboost, init
See also chartboost.load()
chartboost.show()

Overview

chartboost.init() initializes the Chartboost plugin. This call is required and must be executed before making other Chartboost calls such as chartboost.load() or chartboost.show().

Syntax

chartboost.init( listener, params )
listener (required)

Listener. Listener function that will receive adsRequest events.

params (required)

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

Parameter Reference

The params table includes parameters for Chartboost initialization.

appId (required)

String. The App ID for your app, gathered from the Chartboost dashboard.

appSig (required)

String. The App signature for your app, gathered from the Chartboost dashboard.

autoCacheAds (optional)

Boolean. If set to true, Chartboost will automatically attempt to load another ad when one has been consumed via a chartboost.show() call. When false, it's your responsibility to manage loading behavior. Default is false.

customId (optional)

String. Use this to set a custom identifier that can be used to group information in the Chartboost dashboard.

Note

For developers migrating from the Corona Ads incarnation of the Chartboost plugin, the following parameters have been removed from this new plugin:

  • apiKey; replaced by appId and appSig
  • testMode; this is now set per-app in the Chartboost dashboard
  • appOrientation; this is now set per-app in the Chartboost dashboard

Example

local chartboost = require( "plugin.chartboost" )

-- Chartboost listener function
local function adListener( event )

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

-- Initialize the Chartboost plugin
chartboost.init( adListener, { appId="YOUR_CHARTBOOST_APP_ID", appSig="YOUR_CHARTBOOST_APP_SIGNATURE" } )