Type Function Return value none Revision Release 2024.3703 Keywords AdSense, Google Ads, Google AdSense, show See also adSense.init() adSense.*
Shows AdSense Ad, you must call adSense.init() before calling. Only banners are supported at the moment.
adSense.show( adType, parameters )
String. Currently "banner"
is supported.
Table. Table containing additional parameters for the specified ad type — see the next section for details.
String. Ad Slots is created under Console>Ads Overview>By Ad Unit>"Display ads" for banners. In the html code this called under the key data-ad-slot
.
String. supported values are "top"
(default) or "bottom"
.
[Number][api.type. Number]. default value is 100
, this value is for Pixel Units(px
).
[Number][api.type. Number]. default value full device width(100%
), but setting a value is in Pixel Units(px
).
local adSense = require( "plugin.adSense" ) -- AdSense Ads listener function local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization adSense.show("banner",{adSlot="xxxxxxxxx", height=150, position="bottom"}) end end -- Initialize Ad Sense adSense.init(adListener, {clientId="ca-pub-xxxxxxxxxxxxxxxx"} )