adcolony.getInfoForZone()

Type Function
Return value none
Revision Release 2024.3703
Keywords ads, advertising, AdColony, getInfoForZone
See also adcolony.init()

Overview

Gets information about the zone and returns the result as an adsRequest event with an "info" phase.

See event.data for details about the data returned.

Syntax

adcolony.getInfoForZone( zoneName )
zoneName (required)

String. The user-defined AdColony zone name to get information about. Zone names should be specified in the call to adcolony.init().

Example

local adcolony = require( "plugin.adcolony" )

local json = require( "json" )

-- AdColony listener function
local function adListener( event )

    if ( event.phase == "info" ) then
        -- Output zone information
        local zoneInfo = json.decode( event.data )
        print( "isRewardedZone:", zoneInfo.isRewardedZone )
        print( "virtualCurrencyName:", zoneInfo.virtualCurrencyName )
        print( "rewardAmount:", zoneInfo.rewardAmount )
        print( "viewsPerReward:", zoneInfo.viewsPerReward )
        print( "viewsUntilReward:", zoneInfo.viewsUntilReward )
    end
end

-- Initialize the AdColony plugin
adcolony.init( adListener,
    {
        appId = "YOUR_ADCOLONY_APP_ID",
        adZones = {
            interstitial = "YOUR_ADCOLONY_ZONE_ID_1",
            rewardedVideo = "YOUR_ADCOLONY_ZONE_ID_2"
        }
    })

-- Get information about a zone
print( adcolony.getInfoForZone( "interstitial" ) )