This page covers data collection for the Site ID variable. See Site ID for the corresponding reporting dimension.
The site ID variable identifies the ad site. Any string value (typically an ID from your ad-server platform) is acceptable.
a.media.ad.sitec_contextdata.a.media.ad.siteWeb SDK
Set siteID inside mediaCollection.advertisingDetails when calling sendEvent:
alloy("sendEvent", {
xdm: {
eventType: "media.adStart",
mediaCollection: {
advertisingDetails: {
name: "ad-2125",
siteID: "site-42"
},
sessionID: "{sid}",
playhead: 0
}
}
});
Mobile SDK
Pass the site ID as a metadata key in the HashMap argument to trackEvent(AdStart). Use MediaConstants.AdMetadataKeys.SITE_ID.
iOS (Swift)
var metadata: [String: String] = [:]
metadata[MediaConstants.AdMetadataKeys.SITE_ID] = "site-42"
tracker.trackEvent(event: MediaEvent.AdStart, info: adObject, metadata: metadata)
Android (Kotlin)
val metadata = HashMap<String, String>()
metadata[MediaConstants.AdMetadataKeys.SITE_ID] = "site-42"
tracker.trackEvent(Media.Event.AdStart, adObject, metadata)
Roku (BrightScript)
Set siteID inside mediaCollection.advertisingDetails when calling sendMediaEvent for media.adStart:
m.aepSdk.sendMediaEvent({
"xdm": {
"eventType": "media.adStart",
"mediaCollection": {
"advertisingDetails": {
"name": "ad-2125",
"siteID": "site-42"
},
"playhead": 0
}
}
})
Media Edge API
Call the adStart endpoint with siteID inside mediaCollection.advertisingDetails:
{
"events": [{
"xdm": {
"eventType": "media.adStart",
"mediaCollection": {
"advertisingDetails": {
"name": "ad-2125",
"length": 15,
"playerName": "Freewheel",
"podPosition": 0,
"siteID": "site-42"
},
"sessionID": "{sid}",
"playhead": 0
}
}
}]
}
Media SDK
Pass the site ID in the contextData object using ADB.Media.AdMetadataKeys.SiteId:
var contextData = {};
contextData[ADB.Media.AdMetadataKeys.SiteId] = "site-42";
tracker.trackEvent(ADB.Media.Event.AdStart, adInfo, contextData);
Media Collection API
Include media.ad.siteId in the params object:
{
"playerTime": { "playhead": 0, "ts": 1699523820000 },
"eventType": "adStart",
"params": {
"media.ad.siteId": "site-42"
}
}
See the Media Collection API events reference for the full request structure.