chartboost.show()

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

Overview

Shows a Chartboost static interstitial, video interstitial, rewarded video, or the "more apps" screen.

Notes

Syntax

chartboost.show( adType [, namedLocation] )
adType (required)

String. One of the following values:

  • "interstitial"
  • "rewardedVideo"
  • "moreApps"
namedLocation (optional)

String. The advertisement location. If omitted, the legacy "Default" location will be used. Although you can specify any string, Chartboost recommends using one of their pre-defined locations to help keep eCPM levels as high as possible. See the list below for valid pre-defined options.

Predefined Locations

The following list outlines the pre-defined locations recommended by Chartboost:

Location Scene/Description
"Default" Legacy default location
"Startup" Initial startup of the game
"Home Screen" Home screen which the player first sees
"Main Menu" Menu which provides game options
"Game Screen" Game screen where the magic happens
"Achievements" List of achievements in the game
"Quests" Quests, missions, or goals screen
"Pause" Pause screen
"Level Start" Start of the level
"Level Complete" Completion of the level
"Turn Complete" When the player finishes a turn in the game
"IAP Store" Store where the player uses real money to buy virtual goods
"Item Store" Store where the player uses virtual money to buy virtual goods
"Game Over" The "game over" screen
"Leaderboard" List of statistical leaders in the game
"Settings" Screen where player can change game settings
"Quit" Screen displayed immediately before the player exits/quits

Example

local chartboost = require( "plugin.chartboost" )

-- Chartboost listener function
local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        chartboost.load( "interstitial" )

    elseif ( event.phase == "loaded" ) then
        if ( event.type == "interstitial" ) then
            chartboost.show( "interstitial" )
        end
    end
end

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