Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Functionality

The function adngin.cmd.getAvailableAdUnitNames() returns a list of available ad-unit names configured in AdEngine for the site. It is usually used in the browser console to find out which ad-unit are available to declare active ad-units or pass to startAuction().

Syntax

function adngin.cmd.getAvailableAdUnitNames(parameter, callback)

argument name

type

optional

value

description

parameter

null

✔️

Not applicable.

callback

function

✔️

function(result:CallbackResult, success:boolean)

The callback function that is called with the function call result.

CallbackResult

JSON object containing the function call result, which is passed to the provided callback function in order to execute some specific action upon the function call. The object structure is as follows:

CallbackResult = {
  message: "<string holding a debug log of the function call result>",
  data: <Array holding all the ad unit names for this publisher>
}

The callback function will receive the above object as the first parameter and a boolean value translating the function call success status as the second parameter.

Description

After calling the function, AdEngine will provide a list with the names of all configured ad units for the current site under the data field of the JSON object that is passed as the first argument of the provided callback function.

The picture below shows an example result of calling getAvailableAdUnitNames():

Scope

The function can be called at any time during AdEngine execution.

Example

Getting AdEngine current available ad units and logging them in the browser console

adngin.cmd.getAvailableAdUnitNames(null, function(result, success) {
  if (success) {
    console.log(result.data);
  } else { // failed, check what has failed
    console.log(result.message);
  }
});

  • No labels