DAI
This tutorial shows how to integrate DAI ads with AMP.
This page covers: * Providing AMP with a configuration object for DAI. * Providing AMP with the DAI SDK and DAI AMP plugin resource objects. * Providing your DAI configuration * Properties Available for VOD * Properties Available for Live Video * More Information on DAI <br>
1. Providing AMP with a configuration object for DAI
As a first step to include any of AMP plugins, it is needed to include a {@link akamai.amp.PluginConfig} for the desired plugin. In the case of DAI is needed to include the imadai
object (see {@link akamai.amp.dai.DAIConfig}) as part of the plugin configurations.
var config = {
plugins: {
imadai: {
// Your DAI configuration goes here
}
}
};
akamai.amp.AMP.create("amp", config);
2. Providing AMP with the DAI SDK and DAI AMP plugin resource objects
A {@link akamai.amp.Resource} must be included inside the DAI configuration for both the DAI SDK and the DAI Plugin. If you have a custom version of the DAI SDK you can use its url instead of Google’s version by replacing the src
.
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);
3. Providing your DAI configuration
If the imadai
config object is provided, AMP will look for DAI specific properties on the {@link akamai.amp.Media} objects. AMP will use these properties to instantiate the server side ads.
3.1. Properties Available for VOD
-
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);
3.2. Properties Available for Live Video
-
adTagParameters
-
apiKey
-
streamActivityMonitorId
-
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);
4. More Information on DAI
For more information please see the IMA DAI documentation: https://developers.google.com/interactive-media-ads/docs/sdks/html5/dai/