Versions Compared

Key

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

...

The array activeAdUnits declares the ad-units to run an initial auction on this page. Only include ad-units that are available on this page.
The presence of the activeAdUnits array will run an automatic auction for the ad-units listed in the array, even if AdEngine is configured to do manual auction.
Set to undefined if the ad-units should be auctioned in manual-auction mode only. For doing an auction of all units in auto-auction mode, set to undefined or do not declare at all.
If no auction is to be produced, heading directly to the ad server phase (e.g., to refresh some publisher GPT ad units), either set activeAdUnits array to be an empty array or null.
Find more information about ad-units, their naming, and usage in the documentation of startAuction.

adengine.activeLots

The array activeLots declares the auction lots to run an initial auction on this page and/or have some special configuration like lazy loading, video URLs or override settings for GPT ad unit path or auction sizes. Only include lots that are available on this page.
Having the activeLots field in the snigelPubConf object will take precedence over the activeAdUnits field. This means that if both activeAdUnits and activeLots fields are defined in the object, only the last one will be used.
AuctionLot object structure is the same as documented in the startAuction document, and can give one more freedom to define in which divs in the publisher's page will the ad units run, or set special behaviors for the units like lazy loading or specific auction sizes.
The presence of the activeLots array will run an automatic auction for the lots listed in the array, even if AdEngine is configured to do manual auction.
Set to undefined if the ad-units should be auctioned in manual-auction mode only. For doing an auction of all units in auto-auction mode, set to undefined or do not declare at all.
If no auction is to be produced, heading directly to the ad server phase (e.g., to refresh some publisher gpt ad units), either set activeLots array to be an empty array or null.
Find more information about auction lots, their naming, and usage in the documentation of startAuction.

adengine.additionalGptAdSlotIds

The array additionalGptAdSlotIds declares GPT ad-units using their div element id. GPT ad-units are defined using googletag.defineSlot. These additional ad-units will be passed to the Ad Manager without being processed by AdEngine. This allows running all ads through a single call to Ad Manager.

...

The boolean sensitiveContent is used to declare pages that contain sensitive/inappropriate text, image, audio, video, or any other type of content that violate Google Publisher Policies. In case of sensitive content on a page, declare "sensitiveContent": true, which will skip Google AdServer in the bidding process, preventing policy violations, and will render header bidding ads only.

...

Code Block
<script data-cfasync="false" type="text/javascript">
  window.snigelPubConf = {
    "adengine": {
      "activeAdUnits": ["topleaderboard", "sidebar"]
    }
  }
</script>
<script data-cfasync="false" async src="https://cdn.snigelweb.com/adengine/**site.domain**/loader.js" type="text/javascript"></script>

Auction ads for the same unit in two different placement

Since the same ad unit is being auctioned twice for different placements, it's recommended to use the same gpIdUniquifier—the original one—for both auctions if we have a article scrolling page. This ensures that SSPs are aware that it is indeed the same unit, allowing for better tracking and optimization.

Code Block
<script data-cfasync="false" type="text/javascript">
  window.snigelPubConf = {
    "adengine": {
      "activeLots": [
        { placement: 'adngin-sidebar-0', adUnit: 'sidebar', gpIdUniquifier: 'adngin-sidebar-0' },
        { placement: 'adngin-sidebar-1', adUnit: 'sidebar', gpIdUniquifier: 'adngin-sidebar-0' }
      ]
    }
  }
</script>
<script data-cfasync="false" async src="https://cdn.snigelweb.com/adengine/**site.domain**/loader.js" type="text/javascript"></script>
Note

gpIdUniquifier is recommended only on article scrolling page, pages that have an article that when we get to the bottom of it a new article is added with the same ads, this will ensure the ads of the new article will be properly identified by the SSPs. If that’s the case for your page it’s recommended to request help to your account manager.

Auction ads for AdEngine and GPT ad-units

...

Code Block
<script data-cfasync="false" type="text/javascript">
  window.snigelPubConf = {
    "adengine": {
      "activeAdUnits": ["topleaderboard"],
       "targeting": {
          "pbjs": {
            "specialization": "liver" //only used by doceree
          }
       }
    }
  }
</script>
<script data-cfasync="false" async src="https://cdn.snigelweb.com/adengine/**site.domain**/loader.js" type="text/javascript"></script>

...

AdEngine is using the concept of a command queue to queue API commands even before the full stack is loaded. This is the same concept as being used by GPT and AdSense.
The command queue is a structure created even before AdEngine object is complete and ready to execute. This is intended to avoid having commands lost by having an incomplete object. When the adngin object is ready to execute its functions, it then processes the command queue and executes whatever commands are there, guaranteeing a logical order of execution provided by the event system (e.g., the startAuction command cannot run before the configuration commands are run).
So to execute a command in AdEngine, it should be added to the command queue, which is a Javascript array, using the notation adngin.queue.push(), as shown below:

...

All available functions for AdEngine can be found in AdEngine's API reference documentation.

adnginLoaderReady event

...

Code Block
if(window.adngin && window.adngin.adnginLoaderReady) {
  // When adnginLoaderReady boolean is true, it is safe to access command queues like adngin.queue or googletag.queue
  adngin.queue.push(function() {
    adngin.cmd.startAuction();
  });
});

It is important to always use either the event adnginLoaderReady or the boolean adngin.adnginLoaderReady to safely call AdEngine. The two methods could be combined like shown in the following example:

Code Block
varfunction doSomething() {
  adngin.queue.push(function() {
    adngin.cmd.startAuction();
  });
}
if(window.adngin && window.adngin.adnginLoaderReady) { doSomething(); }
else { window.addEventListener('adnginLoaderReady', doSomething); }

...

Wait for AdEngine loader to be ready, then use the command queue to run an auction of all available ad tags using startAuction.

Code Block
<script data-cfasync="false" type="text/javascript">
  window.addEventListener('adnginLoaderReady', function() {
    adngin.queue.push(function() {
      // trigger a new auction
      adngin.cmd.startAuction();
    });
  });
</script>
<script data-cfasync="false" async src="https://cdn.snigelweb.com/adengine/**site.domain**/loader.js" type="text/javascript"></script>

...

Wait for AdEngine loader to be ready, then use the command queue to add GPT ad-units using setGoogletagAdSlotElementIds and run an auction of all available ad tags using startAuction.

Code Block
<script data-cfasync="false" type="text/javascript">
  // define ad-slot using googletag defineSlot
  window.googletag = window.googletag || { cmd: [] };
  googletag.cmd.push(function() {
    googletag.defineSlot("/1234567/incontent", [160, 600], "incontent-div").
      addService(googletag.pubads());
  });
</script>
<script data-cfasync="false" type="text/javascript">
  window.addEventListener("adnginLoaderReady", function() {
    adngin.queue.push(function() {
      adngin.cmd.setGoogletagAdSlotElementIds(["incontent-div"]);
      adngin.cmd.startAuction();
    });
  });
</script>
<script data-cfasync="false" async src="https://cdn.snigelweb.com/adengine/**site.domain**/loader.js" type="text/javascript"></script>

...