Shared Configurations
This page gives you an overview of configurations that you can apply to all ad formats
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.
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' |
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' |
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'} |
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 |
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 } |
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 */ } |
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 */ } |
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 */ } |
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 */ } |
Event | Foreground/background | Play/pause | Hide/show |
---|---|---|---|
ogy_hide | background | pause | hide |
ogy_show | foreground | play | show |
ogy_pause | background | pause | do nothing |
ogy_play | foreground | play | do nothing |
To help you understand and using certain configurations you'll find several examples in the following paragraphs. The examples will use tag based connotation.
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.
<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>
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_error
an 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:
{
media_type: 'video' | 'image'
}
Note that callbacks can be also added in passback configuration (see below)
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.
{
ad_unit_id: string,
asset_key: string,
params:{
header_selector: '#page-header-id',
abort_tag_execution: true
}
}
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: {
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.
Last modified 2mo ago