Appearance
Multi-Format
APS offers a solution that enables you to make a single request for both a Display and Outstream bid, with the highest bid being returned. This is known as a multi-format slot. The Outstream component of the multi-format slot is powered by the APS-provided video player, aps_video_player
.
Before continuing, make sure you have completed the Getting Started steps.
Define slots
APS provides support for two variations of slot definition: the preferred approach is the OpenRTB and AdCOM slot definition, while the APS slot definition is also available as an option.
OpenRTB slot definition preferred
Parameter | Required | Type | Description |
---|---|---|---|
item | required | [object] | OpenRTB 3.0 |
placement | required | object | AdCOM 1.0 |
item.id | required | string | must match the element ID (div) associated with the corresponding GPT ad slot |
item.placement.tagid | optional | string | how the slot will be presented in APS reporting |
item.placement.video.ptype | optional | integer | specifies video subtype |
APS slot definition legacy
Parameter | Required | Type | Description |
---|---|---|---|
slots | required | [object] | a collection of slot definitions |
slotId | required | string | must match the element ID (div) associated with the corresponding GPT ad slot |
slotName | optional | string | how the slot will be presented in APS reporting |
mediaType | required | string | must be set to multi-format |
multiFormatProperties | required | object | must specify display and video params |
js
// define slots
aps.record("ad/slot/define", {
item: [
{
id: "div-slot-1", // must be defined within APS dashboard
spec: {
placement: {
tagid: "name-for-reporting",
sdk: "aps_video_player",
display: {
displayfmt: [{ w: 300, h: 250 }],
},
video: {
ptype: 4, // 2, 3, 4, or 5
w: 300,
h: 250,
},
},
},
},
],
});
// define slots
aps.record("ad/slot/define", {
item: [
{
id: "div-slot-1", // must be defined within APS dashboard
spec: {
placement: {
tagid: "name-for-reporting",
sdk: "aps_video_player",
display: {
displayfmt: [{ w: 300, h: 250 }],
},
video: {
ptype: 4, // 2, 3, 4, or 5
w: 300,
h: 250,
},
},
},
},
],
});
js
// define slots
aps.record("ad/slot/define", {
slots: [
{
slotID: "div-slot-1", // must be defined within APS dashboard
slotName: "name-for-reporting",
mediaType: "multi-format",
multiFormatProperties: {
display: {
sizes: [
[300, 250],
[320, 50],
],
},
video: {
sizes: [[300, 250]],
},
},
},
],
});
// define slots
aps.record("ad/slot/define", {
slots: [
{
slotID: "div-slot-1", // must be defined within APS dashboard
slotName: "name-for-reporting",
mediaType: "multi-format",
multiFormatProperties: {
display: {
sizes: [
[300, 250],
[320, 50],
],
},
video: {
sizes: [[300, 250]],
},
},
},
],
});
Fetch bids, attach targeting, request ads
Fetch bids for the slots declared in the item
array. Attach bid responses as custom targeting to the corresponding GPT slots. Request ads from Google Ad Manager (GAM).
js
// fetch bids
aps
.record("ad/targeting/fetch", {
itemIds: ["div-slot-1"],
})
.then(() => {
googletag.cmd.push(function () {
// set custom targeting on GPT slots
aps.read("ad/attachTargeting")?.({
itemIds: ["div-slot-1"],
adServer: "googletag",
});
// request ads from GAM
googletag.pubads().refresh();
});
});
// fetch bids
aps
.record("ad/targeting/fetch", {
itemIds: ["div-slot-1"],
})
.then(() => {
googletag.cmd.push(function () {
// set custom targeting on GPT slots
aps.read("ad/attachTargeting")?.({
itemIds: ["div-slot-1"],
adServer: "googletag",
});
// request ads from GAM
googletag.pubads().refresh();
});
});