Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

function adngin.cmd.startAuction(lots, callback)

argument name

type

optional

value

description

lots

Array

✔️

Array<string> | Array<AuctionLot> | null

An array of strings holding the ad unit names, an array of AuctionLot objects that contain a pair ad unit/placement, a null value that results in no auction being made or undefined (value or no parameter at all), which will auction all existing ad units.

callback

function

✔️

function(result:CallbackResult, success:boolean)

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

Parameters

lots

value undefined

...

This is the simplest way to select which ad units are going to be auctioned. It's a simple array holding the ad unit names that will take part in the auction. These will be auctioned for their standard placement names, which means that, e.g., adunit1 will be assumed to have a corresponding div in the page with id adngin-adunit1-0.
The placement name is derived from the ad unit name by adding the prefix adngin- and suffix -0, which will result with an example ad unit name of adunit1 to the placement name adngin-adunit1-0.
To know which ad units are available under AdEngine management, the function getAvailableAdUnitNames() can be used in the browser console to get their names.

...

Code Block
AuctionLot = {
  adUnit: string,
  placement: string,
  gpIdUniquifier?: string,
  lazyLoad?: boolean,
  contentVideoUrl?: string,
  sizes?: Array<Array<integer> | string>,
  adUnitPath?: string
};

...

Code Block
AuctionLot = {
  adUnit: "adUnit1Name",
  placement: "adUnit1DivName"
};

The function getAvailableAdUnitNames() can be used in the browser console to get the existing ad units under AdEngine.

AuctionLot.gpIdUniquifier

The gpIdUniquifier allows you to pass a specific string to help SSPs better identify ad units when multiple instances of the same unit are called on the same page. It should always match the div ID of the first instance of the unit, which is typically the default ID generated by the AdEngine-app.

Code Block
AuctionLot = {
  adUnit: "adUnit1Name",
  placement: "adUnit1DivName",
  gpIdUniquifier: "adUnit1DivName of the first instance of the adUnit"
};
AuctionLot.lazyLoad

AdEngine also allows to lazy load ads that are not initially visible in the publisher's page. This can lead to better page performance, by loading the ads only when they get into view, but please take into consideration that it may also impact earnings if the page rarely gets scrolled to the lazy loaded ad position.
To enable lazy loading for a particular lot, the lazyLoad field needs to be added to the AuctionLot structure as follows:

...

A call to startAuction() will start a new auction for the ad-units passed as parameter. After the auction is finished it will call the ad server in order to refresh the ad unit placements with the new ads. In this phase GPT external ad-units set with setGoogletagAdSlotElementIds or setGoogletagAdSlots are refreshed together with AdEngine ad-units.
If there is an existing auction running, AdEngine queues the new auction until the last one is finished. Subsequent calls to startAuction() will refresh ads, which should be used carefully as wrong refresh intervals can cause Google policy violations.

...

AdEngine is running in automatic auction mode by default. Automatic auction means that as soon as AdEngine is loaded in the page, it will start the auction and display ads. It will take into account the active ad-units defined in snigelPubConf or otherwise auction all available ad-units.
In automatic auction mode, startAuction() is used to refresh ad-units, typically triggered by the page on user interaction.

...

Manual auction means that AdEngine is loaded in the page and not displaying ads by default. The only exception is when active ad-units are defined using declarative configuration, in that case AdEngine will do an automatic auction of these ad-units.
If no declarative configuration is found, it is the page responsibility to call startAuction() to display or refresh ads. Manual auction mode gives more freedom, in a programmatic way, how and when ads are displayed. Manual auction mode is typically used in advanced scenarios to have full control of displaying ads.

...

The function can be called after AdEngine loader is ready and the AdEngine queue is defined, see functional configuration for more details.

Examples

...

Code Block
window.addEventListener('adnginLoaderReady', function() {
  adngin.queue.push(function() {
    // trigger a new auction
    adngin.cmd.startAuction([
      {
        adUnit: "adUnit1",
        placement: "otherdiv1"
      },
      {
        adUnit: "adUnit2",
        placement: "otherdiv2"
      }
    ]);
  });
});

Starting an auction for "adUnit1" in placements "otherdiv1" and "otherdiv2"

Code Block
window.addEventListener('adnginLoaderReady', function() {
  adngin.queue.push(function() {
    // trigger a new auction
    adngin.cmd.startAuction([
      {
        adUnit: "adUnit1",
        placement: "otherdiv1",
        gpIdUniquifier: "otherdiv1"
      },
      {
        adUnit: "adUnit1",
        placement: "otherdiv2",
        gpIdUniquifier: "otherdiv1"
      }
    ]);
  });
});

Using GAM path per page with custom sizes

...

Code Block
window.addEventListener('adnginLoaderReady', function() {
  adngin.queue.push(function() {
    // trigger a new auction
    adngin.cmd.startAuction([
      {
        adUnit: "adUnit1",
        placement: "otherdiv1",
        gpIdUniquifier: "otherdiv1",
        sizes: [[300, 250]],
        adUnitPath: "pageGAMAdUnitPathName"
      },
      {
        adUnit: "adUnit1",
        placement: "otherdiv2",
        gpIdUniquifier: "otherdiv1",
        sizes: [[300, 600]],
        adUnitPath: "pageGAMAdUnitPathName"
      }
    ]);
  });
});

...