This page covers data collection for the Content ID variable. See Content for the corresponding reporting dimension.
The content ID variable uniquely identifies each piece of media content. It is required for all streaming media implementations and is the primary key for the Content reporting dimension. Set it at session start and keep it stable across all sessions for the same asset.
a.media.nameWeb SDK
Set name inside mediaCollection.sessionDetails when calling sendEvent:
alloy("sendEvent", {
xdm: {
eventType: "media.sessionStart",
mediaCollection: {
sessionDetails: {
name: "video-123",
friendlyName: "My Video",
length: 128,
contentType: "vod",
playerName: "HTML5 Player",
channel: "Sports",
streamType: "video"
},
playhead: 0
}
}
});
Mobile SDK
Pass the content ID as the mediaId argument to createMediaObject.
iOS (Swift)
let mediaObject = Media.createMediaObjectWith(name: "My Video",
id: "video-123",
length: 128,
streamType: MediaConstants.StreamType.VOD,
mediaType: MediaType.Video)
tracker.trackSessionStart(info: mediaObject, metadata: nil)
Android (Kotlin)
var mediaInfo = Media.createMediaObject("My Video",
"video-123",
128,
MediaConstants.StreamType.VOD,
Media.MediaType.Video)
tracker.trackSessionStart(mediaInfo, null)
Roku (BrightScript)
Set name inside mediaCollection.sessionDetails when calling createMediaSession:
m.aepSdk.createMediaSession({
"xdm": {
"eventType": "media.sessionStart",
"mediaCollection": {
"sessionDetails": {
"name": "video-123",
"friendlyName": "My Video",
"length": 128,
"contentType": "vod",
"playerName": "Roku Player",
"channel": "Sports",
"streamType": "video"
},
"playhead": 0
}
}
})
Media Edge API
Call the sessionStart endpoint with name (the Content ID) inside mediaCollection.sessionDetails:
{
"events": [{
"xdm": {
"eventType": "media.sessionStart",
"mediaCollection": {
"sessionDetails": {
"name": "video-123",
"length": 128,
"contentType": "vod",
"playerName": "HTML5 Player",
"channel": "Sports"
},
"playhead": 0
}
}
}]
}
Media SDK
Pass the content ID as the second argument to ADB.Media.createMediaObject:
var mediaInfo = ADB.Media.createMediaObject(
"My Video", // name (friendly name)
"video-123", // media ID — Content ID
128, // length (seconds)
ADB.Media.StreamType.VOD,
ADB.Media.MediaType.Video
);
tracker.trackSessionStart(mediaInfo, contextData);
Media Collection API
Include media.id in the params object of your sessionStart POST request:
{
"playerTime": { "playhead": 0, "ts": 1699523820000 },
"eventType": "sessionStart",
"params": {
"media.id": "video-123"
}
}
See the Media Collection API sessions reference for the full request structure.