蜜豆视频

Advertising DSP Macros

A macro is a short command or shorthand for an instruction and usually follows the format ${MACRO_NAME}. Macros included in creative code or click-through URLs expand into a longer code string that the ad server can understand. The DSP ad server executes macros when the ad is served or clicked.

Ad server macros are useful for passing important information to DSP or to third-party ad servers. Macros are most commonly used during trafficking of third-party and custom creative code or metadata (such as third-party pixels).

You can manually insert a macro anywhere, such as in a VAST tag, in any URL, or in a DSP or third-party event pixel. However, each DSP client and partner has a different ad tag format, and the macros should be inserted in different spots in the tag accordingly. Each time you work with a new client or partner, ask them for documentation on where to insert the macros in their ad tags that DSP traffics.

General Tracking Macros

Use general tracking macros across all ad and tag types to pass back specific data, as required.

Macro
Replacement Description
Type
${TM_ACCOUNT_ID}
The account ID.
integer
${TM_AD_ID}
The ad key (adKey).
string
${TM_AD_ID_NUM}
The ad ID.
integer
${TM_ADVERTISER_ID}
The advertiser ID.
integer
${TM_CAMPAIGN_ID}
The campaign key.
string
${TM_CAMPAIGN_ID_NUM}
The campaign ID.
integer
${TM_CLICK_URL}
The redirect URL, which enables ad servers to track and count ad clicks. When the ad is served, if the user clicks it, the macro is activated and the click is recorded and counted for reporting purposes.
string
${TM_CLICK_URL_URLENC}
The encoded redirect URL, which enables ad servers to track and count ad clicks. When the ad is served, if the user clicks it, the macro is activated and the click is recorded and counted for reporting purposes. Don鈥檛 use this macro unless you are creating third-party ads and your vendor requires URL encoding.
string
${TM_FEED_ID}
The key for the media placement (feedKey).
string
${TM_FEED_ID_NUM}
The ID for the media placement.
integer
${TM_MACRO_PLACEMENT_SITE_KEY
The site key for the placement. Required for AppsFlyer click trackers for mobile app install ads.
string
${TM_PLACEMENT_ID}
The placement key (cpKey).
string
${TM_PLACEMENT_ID_NUM}
The placement ID.
integer
${TM_RANDOM}
Cachebuster: a random number between 1 and 1000000.
long
${TM_SESSION_ID}
The ID of the session, which corresponds to a single retrieval of the ad tag.
string
${TM_SITE_DOMAIN_URLENC}
The page subdomain parsed from the URL in the bid request; URL-encoded. Not supported for in-banner, click-to-play ads.
string
${TM_SITE_NAME}
The site name for the placement.
string
${TM_SITE_URL_URLENC}
The URL passed in the bid request; URL-encoded. Not supported for in-banner, click-to-play ads.
string
${TM_SITE_ID_NUM}
The site ID for the placement.
integer
${TM_TIMESTAMP}
The Unix timestamp indicating the number of seconds elapsed since midnight (00:00 UTC) on 1 January 1970.
long
${TM_VIDEO_DURATION}
The duration of the ad video in seconds.
integer

Mobile-Specific Macros

Macro
Replacement Description
Type
${CS_PLATFORM_ID}

(ComScore) The platform ID, which corresponds to the device鈥檚 operating system:

  • ios = Apple iOS
  • android = Google Android
  • windows = Windows Mobile
  • blackberry = Blackberry
  • other when the platform is none of the above
varchar(50)
${CS_DEVICE_MODEL}
(ComScore) The device model name, URL-encoded.
string
${CS_IMPLEMENTATION_TYPE}

(ComScore) The environment in which the ad was served:

  • a = mobile application
  • b = mobile website
string (a or b)
${NS_PLATFORM_ID}

(Nielsen) The platform ID, which corresponds to the device鈥檚 operating system:

  • ios= Apple iOS
  • android = Google Android
  • windows = Windows Mobile
  • blackberry = Blackberry
  • other when the platform is none of the above
string
${NS_DEVICE_GROUPING}

(Nielsen) The the device type on which the ad was viewer:

  • TAB = tablet
  • PHN = mobile
  • computer = computer
string
${UOO}

(Nielsen) Whether or not the user has opted out of ad tracking:

  • 1 (DNT flag = 1) = the user has opted out of ad tracking
  • 0 (DNT flag = 0) = the user has opted in to ad tracking
integer (0 or 1)
${TM_BUNDLE}
The iOS or Android app store bundle ID. Examples: com.zynga.wwf2.free or id804379658
string
gdpr=${GDPR_ENFORCED}&gdpr_consent=${GDPR_CONSENT}

gdpr=${GDPR_ENFORCED} indicates if the bidder determines that the bid request comes from the European Union origin and requires GDPR enforcement:

  • 1 = GDPR should be enforced
  • 0 = GDPR should not be enforced

gdpr_consent=${GDPR_CONSENT} is the consent value passed from the supply partner in the inbound bid request:

  • In most cases, this is a base64url-encoded consent string, or daisybit (example: BN5lERiOMYEdiAKAWXEND1HoSBE6CAFAApAMgBkIDIgM0AgOJxAnQA)
  • 0 = no consent
  • 1 = consent
daisybit or integer

Click Macros for Third-Party Display Ads

To accurately track clicks for ads using third-party display tags, DSP requires a display click macro. Only one version of the macro is required; the relevant macro depends on the type of tag.

Macro
Replacement Description
Type
${TM_CLICK_URL}
The redirect URL that enables ad servers to track and count ad clicks in the platform.
string
${TM_CLICK_URL_URLENC}
The redirect URL that enables ad servers that require URL encoding to track and count ad clicks in the platform.
string

DSP automatically inserts display click macros in a third-party display tag when you:

  • Export ad tags from an ad server partner
  • Bulk upload Flashtalking or Google DoubleClick for Advertisers ad tags directly in DSP

If a click macro is missing when you build a display ad, DSP displays a warning message, which prompts you to manually insert the appropriate display click macro in the correct area of the tag.

Analytics for Advertising Macros

For additional macros available specifically for Analytics for Advertising customers, see 鈥Append Analytics for Advertising Macros to Flashtalking Ad Tags鈥 and 鈥Append Analytics for Advertising Macros to Google Campaign Manager 360 Ad Tags.鈥

Troubleshooting Macro Errors

When you add macros to your code, make sure you use the exact syntax of the macro. When validating the macros, DSP checks that the macro exactly matches one of the valid macros.

Errors are generated if characters are missing from the beginning or end of the macro name. For example, an error message is shown if:

  • You forget one or more of the characters at the beginning of the macro name, such as ${. If you don鈥檛 include the full syntax, the entry isn鈥檛 recognized as a valid macro.
  • The macro doesn鈥檛 end with a valid set of characters, such as }.
recommendation-more-help
9ff4800f-94be-45f0-a5bf-09d0d7e96baa