Skip to content

Outstream

Outstream refers to a video ad format that is displayed outside of a traditional video player. Unlike pre-roll or mid-roll ads that appear within video content, outstream ads are typically embedded within non-video content, such as articles or feeds. Outstream ads automatically play when they come into view and may include sound or be muted by default.

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

ParameterRequiredTypeDescription
itemrequired[object]OpenRTB 3.0
placementrequiredobjectAdCOM 1.0
item.idrequiredstringmust match the element ID (div) associated with the corresponding GPT ad slot
item.placement.tagidoptionalstringhow the slot will be presented in APS reporting
item.placement.video.ptypeoptionalintegerspecifies video subtype

APS slot definition legacy

ParameterRequiredTypeDescription
slotsrequired[object]a collection of slot definitions
slotIdrequiredstringmust match the element ID (div) associated with the corresponding GPT ad slot
slotNameoptionalstringhow the slot will be presented in APS reporting
mediaTyperequiredstringmust be set to video
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",
          video: {
            ptype: 4, // 2, 3, or 4
            w: 400,
            h: 225,
          },
        },
      },
    },
  ],
});
// 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",
          video: {
            ptype: 4, // 2, 3, or 4
            w: 400,
            h: 225,
          },
        },
      },
    },
  ],
});
js
// define slots
aps.record("ad/slot/define", {
  slots: [
    {
      slotID: "div-slot-1", // must be defined within APS dashboard
      slotName: "name-for-reporting",
      mediaType: "video",
    },
  ],
});
// define slots
aps.record("ad/slot/define", {
  slots: [
    {
      slotID: "div-slot-1", // must be defined within APS dashboard
      slotName: "name-for-reporting",
      mediaType: "video",
    },
  ],
});

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();
    });
  });