Ad load type

This page covers data collection for the Ad load type variable. See Ad loads for the corresponding reporting dimension.

The ad load type variable identifies the type of ad loaded at the start of the session. This value is defined by your organization’s internal ad delivery system and is not constrained to a standard enumeration. You can use any string meaningful to your implementation, such as "linear", "dynamic", or "programmatic".

Property
Value
Context data variable
a.media.adLoad
XDM collection field
xdm.mediaCollection.sessionDetails.adLoad
Audience Manager trait
c_contextdata.a.media.adLoad
Required
No
Sent with
Session start, session close
Web SDK

Set adLoad inside xdm.mediaCollection.sessionDetails when calling createMediaSession:

code language-javascript
alloy("createMediaSession", {
  xdm: {
    eventType: "media.sessionStart",
    mediaCollection: {
      sessionDetails: {
        name: "video-123",
        friendlyName: "My Video",
        length: 300,
        contentType: "vod",
        playerName: "HTML5 Player",
        channel: "Sports",
        adLoad: "linear"
      },
      playhead: 0
    }
  }
});
iOS

Pass the ad load type as a metadata key in the dictionary argument to trackSessionStart. Use MediaConstants.VideoMetadataKeys.AD_LOAD.

code language-swift
var videoMetadata: [String: String] = [:]
videoMetadata[MediaConstants.VideoMetadataKeys.AD_LOAD] = "linear"

tracker.trackSessionStart(info: mediaObject, metadata: videoMetadata)
Android

Pass the ad load type as a metadata key in the HashMap argument to trackSessionStart. Use MediaConstants.VideoMetadataKeys.AD_LOAD.

code language-kotlin
val videoMetadata = HashMap<String, String>()
videoMetadata[MediaConstants.VideoMetadataKeys.AD_LOAD] = "linear"

tracker.trackSessionStart(mediaInfo, videoMetadata)
Roku

Use createMediaSession to set adLoad inside sessionDetails:

code language-brightscript
m.aepSdk.createMediaSession({
    "xdm": {
        "eventType": "media.sessionStart",
        "mediaCollection": {
            "sessionDetails": {
                "adLoad": "linear"
            },
            "playhead": 0
        }
    }
})
Media Edge API

Call the sessionStart endpoint with adLoad inside xdm.mediaCollection.sessionDetails:

code language-json
{
  "events": [{
    "xdm": {
      "eventType": "media.sessionStart",
      "mediaCollection": {
        "sessionDetails": {
          "name": "video-123",
          "length": 300,
          "contentType": "vod",
          "playerName": "HTML5 Player",
          "channel": "Sports",
          "adLoad": "linear"
        },
        "playhead": 0
      }
    }
  }]
}

Legacy implementation types (Analytics-only)

Media SDK JS 3.x

Pass the ad load type in the contextData object using ADB.Media.VideoMetadataKeys.AdLoad:

code language-javascript
var contextData = {};
contextData[ADB.Media.VideoMetadataKeys.AdLoad] = "linear";

tracker.trackSessionStart(mediaInfo, contextData);
Chromecast

Use ADBMobile.media.VideoMetadataKeys.AD_LOAD to set the ad load type in the StandardMediaMetadata property of the media object before calling trackSessionStart:

code language-javascript
var mediaInfo = ADBMobile.media.createMediaObject("My Video", "video-123", 300,
  ADBMobile.media.StreamType.VOD, ADBMobile.media.MediaType.Video);
var standardMetadata = {};
standardMetadata[ADBMobile.media.VideoMetadataKeys.AD_LOAD] = "linear";
mediaInfo[ADBMobile.media.MediaObjectKey.StandardMediaMetadata] = standardMetadata;
ADBMobile.media.trackSessionStart(mediaInfo, null);
Media Collection API

Include media.adLoad in the params object of your sessionStart POST request:

code language-json
{
  "playerTime": { "playhead": 0, "ts": 1699523820000 },
  "eventType": "sessionStart",
  "params": {
    "media.adLoad": "linear"
  }
}

See the Media Collection API sessions reference for the full request structure.

recommendation-more-help
media-analytics-help