Type Function Return value none Revision 2017.3060 Keywords ads, advertising, AdMob, load See also admob.show() admob.isLoaded() admob.*
Pre-loads an AdMob interstitial, banner, or rewarded video ad for instant display upon a future call to admob.show().
Before calling this function, you must call admob.init() and wait for the "init"
event phase.
Rewarded video ads will not load when test mode is enabled. In this case, you will get a "failed"
phase when trying to load a rewarded video. Please see admob.init() for instructions on how to enable/disable test mode.
admob.load( adType, params )
String. One of the following ad type values:
"interstitial"
(includes both static interstitials and video interstitials)"banner"
"rewardedVideo"
Table. Table containing additional parameters for the specified ad type — see the next section for details.
The params
table includes parameters for the specified ad type.
String. The ad unit ID for the specified ad type, gathered from the AdMob dashboard.
Boolean. Set this to true
to ensure that only false
.
Boolean. Only available on Android (ignored on iOS). When used together with the childSafe
option, you can request ads that comply with Google's Designed for Families program. Essentially, upon seeing both designedForFamilies
and childSafe
set to true
, AdMob will return
Array. An array of strings to be given to the AdMob request to use as keywords. Specifying keywords may increase your CTR.
local admob = require( "plugin.admob" ) -- AdMob listener function local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization -- Load an AdMob interstitial ad admob.load( "interstitial", { adUnitId="YOUR_ADMOB_AD_UNIT_ID" } ) end end -- Initialize the AdMob plugin admob.init( adListener, { appId="YOUR_ADMOB_APP_ID" } )