Shared Configurations

This page gives you an overview of configurations that you can apply to all ad formats

Parameter Configuration Details

Below you'll find a list of parameters that can be used for all Ogury Ad formats. There might be differences depending on the used integration type. Note that prebid integration will require camel case notation whereas all other integration types will use snake case notations. All parameters are case sensitive.

ad_unit_id

asset_key

passback

abort_tag_execution

on_ad_show

on_ad_complete

on_position_change

on_no_ad

on_error

Supported Custom Events

Example Configurations

To help you understand and using certain configurations you'll find several examples in the following paragraphs. The examples will use tag based connotation.

How to use Callbacks

Callbacks provide a way to handle different Ad Response situations such as no ad available.

To use the callbacks, you'll need to create the JavaScript Functions that are supposed to be called for the different statuses first. Afterwards you can pass them as values for on_ad_show, on_no_ad, on_ad_complete , on_error or all together, and they'll be executed for the particular event:

  • on_ad_show : the function that is set for this parameter will be triggered when an ad has started to be shown by the Ogury Tag.

  • on_position_change: the function that is set for this parameter will be triggered when an ad has switched from a positionState to another. The positionState value is sent back in the callback.

    • Possible values for positionState: 'EXPANDED', 'STUCK_MINIMIZED', 'MINIMIZED', 'DEFAULT'.

  • on_no_ad : the function that is set for this parameter will be triggered when the Ogury Tag has no ads to serve.

  • on_ad_complete : the function that is set for this parameter will be triggered when the ad is closed. This happens:

    1. if the user clicks on the ad

    2. if the user clicks on the closing button

    3. if the ad is closed automatically after a predefined timeout.

  • on_error : the function that is set for this parameter will be triggered when there is an error preventing the ad delivery (unsupported environment, user consent conditions, network errors, rendering errors ...).

The JavaScript Functions have to be defined before you initialize the Ogury Tag.

Integration Example - Tag Based

<script type='text/javascript'>
    function onAdShowCallback(adUnit, positionState, adResponseContext) {
        console.log(adUnit)
    }
    function onNoAdCallback(adUnit) {
        // call another Advertising partner
    }
    function onAdCompleteCallback(adUnit, adResponseContext) {
        // call another Advertising partner
    }
    function onErrorCallback(adUnit) {
        // call another Advertising partner
    }

    window.top.OG_ad_units = window.top.OG_ad_units || [];
    window.top.OG_ad_units.push({
        ad_unit_id: '$OGURY_AD_UNIT',
        asset_key: '$OGURY_ASSET_KEY',
        params:{
            max_width: 180,
            max_height: 180
        },
        callbacks: {
            on_ad_show: onAdShowCallback,
            on_no_ad: onNoAdCallback,
            on_ad_complete: onAdCompleteCallback,
            on_error: onErrorCallback,
        }
    });
</script>
<script src="https://mwtw.presage.io/v1/tag.js" async></script>

Callback Arguments

For on_ad_show and on_position_change, a positionState String value will be returned as argument of these functions.

When calling the functions configured for on_ad_show , on_no_ad , on_ad_complete and on_erroran Ad Unit JavaScript Object will be returned as argument of these functions.

Ad Unit Object - Tag Based:

{
   ad_unit_id: string,
   asset_key: string,
   params:{
       max_width: number,
       max_height: number,
       gravity?: string,
       x_margin?: number,
       y_margin?: number,
   },
   callbacks?: {
       on_ad_show?: function,
       on_position_change?: function,
       on_no_ad?: function,
       on_ad_complete?: function,
       on_error?: function,
   }
 }

Note that some parameters are optional (defined with ?) and may not be available if they are not configured for the Ogury Tag.

For on_ad_show and on_ad_complete, an adResponseContext argument provides more details on the shown ad.

adResponseContext Object:

{
   ad_slot: div#ogy-ad-slot | undefined, // The ad slot HTML Element in DOM
   container: div#ogy-root-container, // The container HTML Element in DOM
   iframe: iframe#ogy-iframe, // The Iframe HTML Element in DOM
   in_article_type: '300x250' | 'landscape' | 'reveal' | undefined
   media_type: 'video' | 'image'
}

Note that callbacks can be also added in passback configuration (see below)

Stopping the tag execution

In some scenarios you might need to stop the tag execution and stop the ad request, for instance when handling mobile vs. desktop traffic or when certain elements such as other video players are present on the page.

Example

{
   ad_unit_id: string,
   asset_key: string,
   params:{
      header_selector: '#page-header-id',
      abort_tag_execution: true
   }
}

Passback configuration

It is possible to implement a client side waterfall using the passback configuration. Particularly, you may setup a Passback Object configuration to chain ad requests for distinct ad units.

A typical usage is to target an ad unit with a higher price and another one with a lower price afterwards. A waterfall involving these ad units allows to optimize your monetization and your fill rate.

When the first ad unit will have nothing to serve or fires an error, the tag will check if a passback ad unit has been configured. If yes, the tag will request an ad for the passback ad unit that has been configured.

Passback Object

passback: {
   ad_unit_id: string,
   asset_key?: string,
   params?:{
       max_width?: number,
       max_height?: number,
       gravity?: string,
       x_margin?: number,
       y_margin?: number,
   },
   callbacks?: {
       on_ad_show?: function,
       on_position_change?: function,
       on_no_ad?: function,
       on_ad_complete?: function,
       on_error?: function,
   }
 }

Note that only ad_unit_id field is mandatory, all others params will be by default inherited from initial ad unit configuration if they are not redefined in passback object.

Ad unit object containing passback configuration:

 {
   ad_unit_id: string,
   asset_key: string,
   params:{
      max_width: number,
      max_height: number,
      gravity?: string,
      x_margin?: number,
      y_margin?: number,
   },
   callbacks?: {
       on_ad_show?: function,
       on_position_change?: function,
       on_no_ad?: function,
       on_ad_complete?: function,
       on_error?: function,
   },
   passback?: {
       ad_unit_id: string,
       asset_key?: string,
       params?:{
           max_width?: number,
           max_height?: number,
           gravity?: string,
           x_margin?: number,
           y_margin?: number,
       },
       callbacks?: {
           on_ad_show?: function,
           on_position_change?: function,
           on_no_ad?: function,
           on_ad_complete?: function,
           on_error?: function,
       }
     }
 }

Complete Example - Tag Based:

<script type='text/javascript'>
    function onAdShowCallback(adUnit, positionState, adResponseContext) {
        console.log(adUnit)
    }
    function onNoAdCallback(adUnit) {
        // call another Advertising partner
    }
    function onAdCompleteCallback(adUnit, adResponseContext) {
        // call another Advertising partner
    }
    function onErrorCallback(adUnit) {
        // call another Advertising partner
    }

    window.top.OG_ad_units = window.top.OG_ad_units || [];
    window.top.OG_ad_units.push({
        ad_unit_id: '$OGURY_AD_UNIT',
        asset_key: '$OGURY_ASSET_KEY',
        params:{
            max_width: 180,
            max_height: 180
        },
        callbacks: {
            on_ad_show: onAdShowCallback,
            on_no_ad: onNoAdCallback,
            on_ad_complete: onAdCompleteCallback,
            on_error: onErrorCallback,
        },
        passback: {
            ad_unit_id: '$OGURY_AD_UNIT_PASSBACK',
        }
    });
</script>
<script src="https://mwtw.presage.io/v1/tag.js" async></script>>

You need to replace $OGURY_AD_UNIT_PASSBACK by the value you received during the configuration in the platform.

The passback ad unit configuration will have by default, inherited configuration of the initial ad unit. It is possible to override it with a new configuration

  1. If you already have a video unit in place, ask your Publisher Manager to create a second Ad Unit or do so by yourself in the Publisher Cloud. Update your existing tag with passback configuration for the new ad unit.

  2. If you don't use the Thumbnail yet, ask your Publisher Manager to create the necessary Assets and Ad Units, insert them into the tag above and integrate it in your website.

Managing overlaps

You may have elements in your web page that need to be temporarily displayed above the Footer Ad in order to allow interactions with the users (i.e, menus, modals ...). In that case you should trigger custom Javascript events that would bring the Footer Ad to background and then to foreground again.

Example

Let's consider the case where you have a page menu identified by burger-menu-id. You should include code similar to the following in your menu handling function in order to send the Footer Ad to the background.

const burgerMenu = document.getElementById('burger-menu-id');
burgerMenu.addEventListener('click', () => {
    // send the Footer Ad to background
    window.top.dispatchEvent(new Event('ogy_hide'));
    
    // show the menu
    ...
});

Afterwards, you should bring the Footer Ad back to foreground as follows:

const burgerMenuItem = document.getElementById('burger-menu-item-id');
burgerMenu.addEventListener('click', () => {
    // update the content of some page elements
    ...

    // bring the Footer Ad to foreground
    window.top.dispatchEvent(new Event('ogy_show'));
});

If the Footer Ad creative is a video, it will stop playing on ogy_hide event and resumed on ogy_show .

Please make sure you properly use the events described above as they may impact the viewability and the performance of the ads on your web pages.

Last updated