Using Google IMA DAI feeds with AMP

The IMA DAI plugin is used to enable server-side ad insertion for live and VOD media in AMP. The plugin can be implemented by providing a imadai object in the player config:

var config = {
  plugins: {
    imadai: {
      resources: [
        {src: "//imasdk.googleapis.com/js/sdkloader/ima3_dai.js", type: "text/javascript", async: true},
        {src: "${paths.plugins}imadai/Imadai.js", type: "text/javascript", async: true}
      ]
    }
  },
};
akamai.amp.AMP.create("amp", config);

When the imadai config is provided, the player will for IMA DAI specific properties on the media object to instantiate server-side ads. For VOD the available properties are:

  • contentSourceId: Unique identifier for the publisher content, from a CMS. Required for on-demand streams.
  • videoId: Identifier for the video content source. Required for on-demand streams.
  • apiKey: The stream request API key. It's configured through the DFP Admin UI and provided to the publisher to unlock their content. It verifies the applications that are attempting to access the content.
  • streamActivityMonitorId: The ID to be used to debug the stream with the stream activity monitor. This is used to provide a convenient way to allow publishers to find a stream log in the stream activity monitor tool.
  • adTagParameters: You can override a limited set of ad tag parameters on your stream request. Supply targeting parameters to your stream provides more information. You can use the dai-ot and dai-ov parameters for stream variant preference. See Override Stream Variant Parameters for more information.
var config = {
  media: {
    src: "http://storage.googleapis.com/testtopbox-public/video_content/bbb/master.m3u8",
    type: "application/x-mpegURL",
    contentSourceId: "19463",
    videoId: "tears-of-steel"
  },
  plugins: {
    imadai: {
      resources: [
        {src: "//imasdk.googleapis.com/js/sdkloader/ima3_dai.js", type: "text/javascript", async: true},
        {src: "${paths.plugins}imadai/Imadai.js", type: "text/javascript", async: true}
      ]
    }
  },
};
akamai.amp.AMP.create("amp", config);

For live streams adTagParameters, apiKey, streamActivityMonitorId can be set as well as:

  • assetKey: This is used to determine which stream should be played. The live stream request asset key is an identifier which can be found in the DFP UI.
var config = {
  media: {
    src: "http://storage.googleapis.com/testtopbox-public/video_content/bbb/master.m3u8",
    type: "application/x-mpegURL"
    temporalType: "live",
    assetKey: "sN_IYUG8STe1ZzhIIE_ksA"
  },
  plugins: {
    imadai: {
      resources: [
        {src: "//imasdk.googleapis.com/js/sdkloader/ima3_dai.js", type: "text/javascript", async: true},
        {src: "${paths.plugins}imadai/Imadai.js", type: "text/javascript", async: true}
      ]
    }
  },
};
akamai.amp.AMP.create("amp", config);

For more information please see the IMA DAI documentation: https://developers.google.com/interactive-media-ads/docs/sdks/html5/dai/