Ad name

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

The ad name variable is the human-readable title of the ad (for example, "Ford F-150"). Set it on every media.adStart event.

Property
Value
Context data variable
a.media.ad.friendlyName
XDM collection field
xdm.mediaCollection.advertisingDetails.friendlyName
Audience Manager trait
c_contextdata.a.media.ad.friendlyName
Required
No
Sent with
Ad start, ad close
Web SDK

Set friendlyName inside xdm.mediaCollection.advertisingDetails when calling sendEvent:

code language-javascript
alloy("sendEvent", {
  xdm: {
    eventType: "media.adStart",
    mediaCollection: {
      advertisingDetails: {
        name: "ad-2125",
        friendlyName: "Ford F-150"
      },
      sessionID: "{sid}",
      playhead: 0
    }
  }
});
iOS

Pass the ad name as the first (name) argument to createAdObject. The second argument is the ad ID.

code language-swift
let adObject = Media.createAdObjectWith(name: "Ford F-150",
                                          id: "ad-2125",
                                    position: 0,
                                      length: 15)

tracker.trackEvent(event: MediaEvent.AdStart, info: adObject, metadata: nil)
Android

Pass the ad name as the first (name) argument to createAdObject. The second argument is the ad ID.

code language-kotlin
val adObject = Media.createAdObject("Ford F-150",
                                    "ad-2125",
                                    0L,
                                    15.0)

tracker.trackEvent(Media.Event.AdStart, adObject, null)
Roku Edge

Set friendlyName inside xdm.mediaCollection.advertisingDetails when calling sendMediaEvent for media.adStart:

code language-brightscript
m.aepSdk.sendMediaEvent({
    "xdm": {
        "eventType": "media.adStart",
        "mediaCollection": {
            "advertisingDetails": {
                "name": "ad-2125",
                "friendlyName": "Ford F-150",
                "length": 15,
                "podPosition": 0,
                "playerName": "Roku Player"
            },
            "playhead": 0
        }
    }
})
Media Edge API

Call the adStart endpoint with friendlyName inside xdm.mediaCollection.advertisingDetails:

code language-json
{
  "events": [{
    "xdm": {
      "eventType": "media.adStart",
      "mediaCollection": {
        "advertisingDetails": {
          "name": "ad-2125",
          "friendlyName": "Ford F-150",
          "length": 15,
          "playerName": "Freewheel",
          "podPosition": 0
        },
        "sessionID": "{sid}",
        "playhead": 0
      }
    }
  }]
}

Legacy implementation types (Analytics-only)

Media SDK JS 3.x

Pass the ad name as the first argument to ADB.Media.createAdObject:

code language-javascript
var adInfo = ADB.Media.createAdObject(
  "Ford F-150",
  "ad-2125",
  0,
  15
);

tracker.trackEvent(ADB.Media.Event.AdStart, adInfo, contextData);
Chromecast

Pass the ad name as the first argument to ADBMobile.media.createAdObject:

code language-javascript
var adInfo = ADBMobile.media.createAdObject(
  "Ford F-150",
  "ad-2125",
  1,
  30
);
ADBMobile.media.trackEvent(ADBMobile.media.Event.AdStart, adInfo, null);
Roku 2.x

Pass the ad name as the first argument to adb_media_init_adinfo:

code language-brightscript
adb = ADBMobile()
adInfo = adb_media_init_adinfo("Ford F-150", "ad-2125", 1, 30.0)  ' name, id, position, length

adb.mediaTrackEvent(adb.MEDIA_AD_START, adInfo)
Media Collection API

Include media.ad.name in the params object of your adStart POST request:

code language-json
{
  "playerTime": { "playhead": 0, "ts": 1699523820000 },
  "eventType": "adStart",
  "params": {
    "media.ad.name": "Ford F-150"
  }
}

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

recommendation-more-help
media-analytics-help