Type Function Return value none Revision Release 2025.3721 Keywords AdSense, Google Ads, Google AdSense, init See also adSense.show() adSense.*
Initalizes the Google AdSense plugin. This step is mandatory before any other features or methods can be used.
adSense.init( listener, parameters )
Listener. Listener function that will receive adsRequest events.
Table. Table containing AdMob initialization values — see the next section for details.
The params table includes parameters for Ad Sense initialization.
String. Also the data-ad-client in code and should look like ca-pub-xxxxxxxxxxxxxxxx
local adSense = require( "plugin.adSense" )
-- AdSense Ads listener function
local function adListener( event )
if ( event.phase == "init" ) then -- Successful initialization
end
end
-- Initialize AdSense
adSense.init(adListener, {clientId="ca-pub-xxxxxxxxxxxxxxxx"} )