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

Description

The ID of your ad unit - defines ad format and integration type

Prebid.js Notation

adUnitId

Required

yes

Type

String

Example Value

'97e72f94-91c2-4f16-acca-1b769146de3b'

asset_key

Description

The asset key for your publisher account - directly linked to your domain

Prebid.js Notation

assetKey

Required

yes

Type

String

Example Value

'OGY-3FF6A2B9350D'

passback

Description

Object that defines a second ad unit configuration that will be requested if on_no_ad or on_error have been triggered

Prebid.js Notation

n/a

Required

yes

Type

Object

Example Object

passback: { ad_unit_id: '97e72f94-91c2-4f16-acca-1b769146de3b'}

abort_tag_execution

Description

Will stop the tag and therewith the ad request execution

Prebid.js Notation

n/a

Required

no

Type

Boolean

Values

true|false

Default Value

false

on_ad_show

Description

Callback function that will be executed when the ad is displayed

Prebid.js Notation

onAdShow

Required

no

Type

function

Parameters

adUnit: Object

positionState: String

adResponseContext: Object

Example function

function onAdShowCallback(adUnitObject, positionState, adResponseContext){ // your code }

on_ad_complete

Description

Callback function that will be executed when the ad has been clicked, closed or finished

Prebid.js Notation

onAdComplete

Required

no

Type

function

Parameters

adUnit: Object

adResponseContext: Object

Example function

function onAdCompleteCallback(adUnitObject, adResponseContext){ /** your code */ }

on_position_change

Description

Callback function that will be executed when the state of the ad changes

Prebid.js Notation

onPositionChange

Required

no

Type

function

Parameters

positionState: String : 'EXPANDED', 'STUCK_MINIMIZED', 'MINIMIZED, 'DEFAULT'

Example function

function onPositionChangeCallback(adUnitObject, adResponseContext){ /** your code */ }

on_no_ad

Description

Callback function that will be executed when the ad response is empty

Prebid.js Notation

n/a

Required

no

Type

function

Example function

function onNoAdCallback(){ /** your code */ }

on_error

Description

Callback function that will be executed when an error occurs. This can happen before, during and after the ad delivery.

Prebid.js Notation

onError

Required

no

Type

function

Example function

function onErrorCallback(){ /** your code */ }

Supported Custom Events

EventForeground/backgroundPlay/pauseHide/show

ogy_hide

background

pause

hide

ogy_show

foreground

play

show

ogy_pause

background

pause

do nothing

ogy_play

foreground

play

do nothing

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