kidoz.show()

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

Overview

Shows a KIDOZ ad which was previously loaded via kidoz.load().

Gotchas

This call does not necessarily reveal the actual ad view. For example, if you load a "panelView" ad, only the initial UI handle will be shown by default. From this point, the user can tap the handle to reveal the ad view. However, the panel view can be configured without any UI element for the user to manipulate — in this case, kidoz.show() will fully reveal the ad view.

Syntax

kidoz.show( adType )
adType (required)

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

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 )
        -- Show the ad
        kidoz.show( "panelView" )
    end
end

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