For the complete documentation index, see llms.txt. This page is also available as Markdown.

relevantDigital.addAuctionCallbacks()

Register global auction callbacks without changing the `loadPrebid()` call.

Use relevantDigital.addAuctionCallbacks() when you cannot change the relevantDigital.loadPrebid() call. For example, register callbacks from custom JavaScript in the Yield UI.

Register callbacks

Example

window.relevantDigital = window.relevantDigital || {};
relevantDigital.cmd = relevantDigital.cmd || [];
relevantDigital.cmd.push(function() {
   relevantDigital.addAuctionCallbacks({
       onSlotAndUnit: function({ slot, unit }) {
           console.info('Relevant Yield auction object', this);
           console.info('Slot and unit', slot, unit);
       },
       onBeforeAdRequest: function(params) {
           console.info('Relevant Yield auction object', this);
           console.info('Parameters', params);
       },        
   }); 
});

Callback behavior

  • this is the auction object.

  • Callbacks registered for the same event run in registration order.

  • You can intercept any auction-object function.

  • This includes callbacks normally passed to loadPrebid().

Run a callback after the default handler

Listeners run before the default callback or function. Pass { when: 'after' } as the second argument to run a listener afterward.

Use this option to inspect or modify the default return value.

Example

Return values

  • The default return value is the first callback argument.

  • The normal callback arguments follow it.

  • Return the first argument to preserve the default result.

Last updated

Was this helpful?