This page covers data collection for the Campaign ID variable. See Campaign ID for the corresponding reporting dimension.
The campaign ID variable identifies the ad campaign that the creative belongs to. Any string value (typically a campaign ID from your ad-server platform) is acceptable. Use the variable to roll up engagement across multiple creatives that share a campaign.
a.media.ad.campaignc_contextdata.a.media.ad.campaignRecommended implementation types
Set campaignID inside xdm.mediaCollection.advertisingDetails when calling sendEvent:
| code language-javascript |
|---|
|
Pass the campaign ID as a metadata key in the HashMap argument to trackEvent(AdStart). Use MediaConstants.AdMetadataKeys.CAMPAIGN_ID.
| code language-swift |
|---|
|
Pass the campaign ID as a metadata key in the HashMap argument to trackEvent(AdStart). Use MediaConstants.AdMetadataKeys.CAMPAIGN_ID.
| code language-kotlin |
|---|
|
Set campaignID inside xdm.mediaCollection.advertisingDetails when calling sendMediaEvent for media.adStart:
| code language-brightscript |
|---|
|
Call the adStart endpoint with campaignID inside xdm.mediaCollection.advertisingDetails:
| code language-json |
|---|
|
Legacy implementation types (Analytics-only)
Pass the campaign ID in the contextData object using ADB.Media.AdMetadataKeys.CampaignId:
| code language-javascript |
|---|
|
Set the campaign ID using ADBMobile.media.AdMetadataKeys.CAMPAIGN_ID in the standard ad metadata object:
| code language-javascript |
|---|
|
Set the campaign ID using MEDIA_AdMetadataKeyCAMPAIGN_ID in the standard ad metadata object:
| code language-brightscript |
|---|
|
Include media.ad.campaignId in the params object:
| code language-json |
|---|
|
See the Media Collection API events reference for the full request structure.