kidoz.init()

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

Overview

kidoz.init() initializes the KIDOZ plugin.

Once initialized, you can load an ad using kidoz.load() and subsequently show it via kidoz.show().

Note

This call requires your KIDOZ publisher ID and security token, obtained from the KIDOZ developer portal.

Syntax

kidoz.init( adListener, params )
adListener (required)

Listener. Listener function that will receive adsRequest events.

params (required)

Table. Table containing KIDOZ initialization values — see the next section for details.

Parameter Reference

The params table includes parameters for the KIDOZ initialization.

publisherID (required)

String. Your publisher ID from KIDOZ.

securityToken (required)

String. Your security token from KIDOZ.

Example

local kidoz = require( "plugin.kidoz" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.provider )
    end
end

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