Album

This page covers data collection for the Album variable. See Album for the corresponding reporting dimension.

The album variable is the name of the album the audio track belongs to (for example, "Pinegrove"). Use it to roll up engagement across tracks from the same album.

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

Set album inside xdm.mediaCollection.sessionDetails when calling sendEvent:

code language-javascript
alloy("sendEvent", {
  xdm: {
    eventType: "media.sessionStart",
    mediaCollection: {
      sessionDetails: {
        album: "Pinegrove"
      },
      playhead: 0
    }
  }
});
iOS

Pass the album as a metadata key in the HashMap argument to trackSessionStart. Use MediaConstants.AudioMetadataKeys.ALBUM.

code language-swift
var metadata: [String: String] = [:]
metadata[MediaConstants.AudioMetadataKeys.ALBUM] = "Pinegrove"

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

Pass the album as a metadata key in the HashMap argument to trackSessionStart. Use MediaConstants.AudioMetadataKeys.ALBUM.

code language-kotlin
val metadata = HashMap<String, String>()
metadata[MediaConstants.AudioMetadataKeys.ALBUM] = "Pinegrove"

tracker.trackSessionStart(mediaInfo, metadata)
Roku Edge

Use createMediaSession to set album inside sessionDetails:

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

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

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

Legacy implementation types (Analytics-only)

Media SDK JS 3.x

Pass the album in the contextData object using ADB.Media.AudioMetadataKeys.Album:

code language-javascript
var contextData = {};
contextData[ADB.Media.AudioMetadataKeys.Album] = "Pinegrove";

tracker.trackSessionStart(mediaInfo, contextData);
Chromecast

Use ADBMobile.media.AudioMetadataKeys.ALBUM to set the album in the StandardMediaMetadata property of the media object before calling trackSessionStart:

code language-javascript
var mediaInfo = ADBMobile.media.createMediaObject("My Track", "audio-123", 240,
  ADBMobile.media.StreamType.AOD, ADBMobile.media.MediaType.Audio);
var standardMetadata = {};
standardMetadata[ADBMobile.media.AudioMetadataKeys.ALBUM] = "Pinegrove";
mediaInfo[ADBMobile.media.MediaObjectKey.StandardMediaMetadata] = standardMetadata;
ADBMobile.media.trackSessionStart(mediaInfo, null);
Roku 2.x

Use MEDIA_AudioMetadataKeyALBUM to set the album in the standard metadata of the media object before calling mediaTrackSessionStart:

code language-brightscript
adb = ADBMobile()
mediaInfo = adb_media_init_mediainfo("My Track", "audio-123", 240.0, adb.MEDIA_STREAM_TYPE_AOD, adb.MEDIA_TYPE_AUDIO)

standardMetadata = {}
standardMetadata[adb.MEDIA_AudioMetadataKeyALBUM] = "Pinegrove"
mediaInfo[adb.MEDIA_STANDARD_MEDIA_METADATA] = standardMetadata

adb.mediaTrackSessionStart(mediaInfo, invalid)
Media Collection API

Include media.album in the params object:

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

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

recommendation-more-help
media-analytics-help