kidoz.isLoaded()

Type Function
Return value Boolean
Revision Release 2024.3703
Keywords ads, advertising, KIDOZ, isLoaded
See also kidoz.show()
kidoz.*

Overview

Checks to see if a KIDOZ ad is already loaded. Returns true if an ad is loaded/ready, otherwise returns false.

Syntax

kidoz.isLoaded( adType )
adType (required)

String. The ad type to check. Valid values include "panelView", "banner", and "interstitial".

Example

local kidoz = require( "plugin.kidoz" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.provider )
        -- Load a KIDOZ panel view ad
        kidoz.load( "panelView", { adPosition="bottom" } )

    elseif ( event.phase == "loaded" ) then  -- The ad was successfully loaded
        print( event.type )
    end
end

-- Initialize the KIDOZ plugin
kidoz.init( adListener, { publisherID="YOUR_PUBLISHER_ID", securityToken="YOUR_SECURITY_TOKEN" } )

-- Sometime later, check if the panel view is loaded
local isAdLoaded = kidoz.isLoaded( "panelView" )
print( isAdLoaded )