Type Function Return value none Revision Release 2024.3703 Keywords ads, advertising, AdColony, init See also adcolony.load() adcolony.show()
adcolony.init()
initializes the AdColony plugin. This call is required and must be executed before making other AdColony calls such as adcolony.load() and adcolony.show().
adcolony.init( listener, params )
Listener. Listener function that will receive adsRequest events.
Table. Table containing AdColony initialization values — see the next section for details.
The params
table includes parameters for the AdColony initialization.
For developers migrating from the Corona Ads incarnation of the AdColony plugin, the following parameters have been removed from this new plugin:
apiKey
(replaced by appId
)testMode
; this is now set per-app in the AdColony dashboardTable. A table of key-value pairs containing your zones, as defined in the AdColony dashboard. Keys are interstitial
and rewardedVideo
since these names are what you'll use in calls to other functions within this plugin. The value for each
String. The preferred orientation in which you want the ads to be displayed. Valid values are "portrait"
and "landscape"
. Default is "landscape"
.
String. A unique user ID to be given to the current user.
Boolean. If true
, turns on debug logging which displays extra debugging information in the device log. Default is false
.
Table. A table of key-value pairs containing used privacy regulations as keys and boolean values (true
if used) as values. Set only those which are valid for current user. Choices are as follows:
privacyFrameworks = { gdpr=true, coppa=true, ccpa=true },
Table. A table of key-value pairs containing consent values for privacy frameworks. Set only those which are valid for current user.
privacyConsents = { gdpr=true, coppa=true, ccpa=true },
##### hasUserConsent (optional) Boolean. If set to false
, AdColony will enable GDPR data collection restrictions, set to true
for opposite.
local adcolony = require( "plugin.adcolony" ) -- AdColony listener function local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization print( event.provider ) 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" } })