[EN] Adagio Refresh
Adagio Refresh for Prebid.js
The configuration of Refresh is set by Adagio as this feature is still in beta version.
To identify and track refresh calls, we recommend to configure your ad-server with special targeting keys bellow:
adg_pn | number | The current print number of the ad-unit. Note: The key is not present on the first print, meaning there is no |
|
adg_refresh | boolean | Should be added when the ad-call is due to a Adagio Refresh action |
|
Basic Adagio Refresh with GPT
Adagio can handle the whole process of refreshing a slot for GPT through Prebid.js.
Before the ad-request is done, the two Adagio Refresh specific targeting keys will be added to the slot.
Custom Refresh
Adagio dispatches an event before refresh is done which can be used to provide a custom logic.
The adagio.refresh.onBeforeRefresh
is a cancellable event dispatched at the very beginning of the refresh process, if cancelled, the owner Adagio code is not executed and the site owner is responsible of the call of pbjs.requestBids()
to start a new bid.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* @param e Custom event
* e.detail custom event detail object.
* - adUnitCode: adUnit code as defined in the Prebid.js config
* - adUnitElementId: id attribute of html element where the ad-unit is bound
* - refreshConfig: refresh config for the current ad-unit
* - currentPrintNumber: current print number
*/
const onBeforeRefreshEvent = function(e) {
e.preventDefault(); // Call this function to prevent Adagio from starting an auction.
try {
// Write here your custom code, like starting an auction by calling pbjs.requestBids().
// The Code bellow is here for example purpose only
// Get current slot to refresh and add Custom targeting keys
const slots = googletag.pubads().getSlots();
const slot = slots.filter(s => s.getSlotElementId() === e.detail.adUnitElementId)[0];
if (!slot) {
return;
}
slot.setTargeting('adg_refresh', 'true');
slot.setTargeting('adg_pn', e.detail.currentPrintNumber + 1);
// Call prebid.js requestBids()
pbjs.requestBids({
adUnits: [
{
// adUnitCode config
}
],
bidsBackHandler: function() {
window.top.googletag.pubads().refresh([slot]);
}
});
} catch (err) {
console.log(err);
}
};
window.top.document.addEventListener('adagio.refresh.onBeforeRefresh', onBeforeRefreshEvent);
Do Not Refresh
doNotRefresh allows the publisher to manage refresh exclusions by ad-units, on the current page. For example, a road-block campaign needs the use of doNotRefresh.
The configuration aims to define the doNotRefresh
property on the global window.top.ADAGIO
object. the configuration is mainly done from the ad-server when setting up a “creative” by adding the following JS code:
1
2
3
4
try {
window.top.ADAGIO.doNotRefresh = window.top.ADAGIO.doNotRefresh || []
window.top.ADAGIO.doNotRefresh.push('adunit_code')
} catch(e) {}
| Refresh will be deactivated for all the ad units in the current page |
| Refresh will be deactivated for specified ad-units |
| Refresh will be deactivated for all the ad units in the current page. |