Label

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

The label variable is the name of the record label that released the audio content (for example, "Capitol Records"). Use it to compare engagement across labels in a music or podcast catalog.

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

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

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

Pass the label as a metadata key in the HashMap argument to trackSessionStart. Use MediaConstants.AudioMetadataKeys.LABEL.

code language-swift
var metadata: [String: String] = [:]
metadata[MediaConstants.AudioMetadataKeys.LABEL] = "Capitol Records"

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

Pass the label as a metadata key in the HashMap argument to trackSessionStart. Use MediaConstants.AudioMetadataKeys.LABEL.

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

tracker.trackSessionStart(mediaInfo, metadata)
Roku Edge

Use createMediaSession to set label inside sessionDetails:

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

Call the sessionStart endpoint with label 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",
          "label": "Capitol Records"
        },
        "playhead": 0
      }
    }
  }]
}

Legacy implementation types (Analytics-only)

Media SDK JS 3.x

Pass the label in the contextData object using ADB.Media.AudioMetadataKeys.Label:

code language-javascript
var contextData = {};
contextData[ADB.Media.AudioMetadataKeys.Label] = "Capitol Records";

tracker.trackSessionStart(mediaInfo, contextData);
Chromecast

Use ADBMobile.media.AudioMetadataKeys.LABEL to set the record label 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.LABEL] = "Capitol Records";
mediaInfo[ADBMobile.media.MediaObjectKey.StandardMediaMetadata] = standardMetadata;
ADBMobile.media.trackSessionStart(mediaInfo, null);
Roku 2.x

Use MEDIA_AudioMetadataKeyLABEL to set the record label 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_AudioMetadataKeyLABEL] = "Capitol Records"
mediaInfo[adb.MEDIA_STANDARD_MEDIA_METADATA] = standardMetadata

adb.mediaTrackSessionStart(mediaInfo, invalid)
Media Collection API

Include media.label in the params object:

code language-json
{
  "playerTime": { "playhead": 0, "ts": 1699523820000 },
  "eventType": "sessionStart",
  "params": {
    "media.label": "Capitol Records"
  }
}

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

recommendation-more-help
media-analytics-help