DOCUMENTATION
« Documentation home

Dynamic Ad Creative Macros

Introduction

The following are macros you can insert into your ad HTML, CSS, and Javascript. When your ad gets served, these macros will be populated with the corresponding content.

For example, using the $D{WIDTH} macro in your ad HTML will cause the macro to be replaced with the ad width of "300" when your HTML is served within a 300x250 creative.

Notes

  • Macros are all upper-case and cannot distinguish underlying parameters that are case-sensitive.
  • Macros will not work in standalone CSS or JS files that have been separately uploaded. You must either embed your CSS/JS in the ad HTML (within <style> or <script> tags) or use the editable Canned Banners CSS/JS modules.

Standard creative macros

These macros respond to characteristics of the ad creative.

Macro Description
$D{WIDTH} The width of the creative in pixels. E.g., "300"
$D{HEIGHT} The height of the creative in pixels. E.g., "250"
$D{CDN_URL} Expands to the full secure (HTTPS) URL of the CDN container for the creative. This macro is useful for including static assets such as images in the ad HTML without having to include the full CDN path.

For example, $D{CDN_URL}/myImage.jpg might expand to https://a18899ddc5bbacfef830-35dfb6b7e8a24a215f48f3cfac4f12c4.ssl.cf2.rackcdn.com/myImage.jpg
$D{TSEG} The Tracking Group for the creative as a whole. The Tracking Group can be set via the "tSeg" ad tag param, or via the Viewer's Audience Profile.
$D{CACHEBUSTER} Cachebuster macro that expands to a random 10-digit integer (e.g., 6094422728).

Click macros

Macro Description
$D{CLICK_URL} The DSP click tracker URL. This is passed into the ad tag using the "click" param.
$D{URL_ENC_CLICK_URL}, $D{HTML_ENC_CLICK_URL } Expands to URL- and HTML-encoded versions of the $D{CLICK_URL}, respectively.
$D{BACKUP_CLICK_URL_COMPLETE} A concatenated value constructed in the following order:
$D{URL_ENC_BACKUP_CLICK_URL_COMPLETE}, $D{HTML_ENC_BACKUP_CLICK_URL_COMPLETE} Expands to URL- and HTML-encoded versions of the $D{BACKUP_CLICK_URL_COMPLETE}, respectively.
$D{LP_PRE} Expands to whatever string was passed in via the ad tag's "lpPre" param. Normally this string would be a static click tracker URL (e.g., DCM click tracker).
$D{LP_APP} Expands to whatever string was passed in via the ad tag's "lpApp" param. Normally this string would be UTM tracking params to be appended to a final landing page URL.
$D{URL_ENCODE_LP} Expands to 0 or 1 based on the ad tag's "urlEncodeLp" param setting. Or if no value was passed in via the ad tag, expands to 0.

Segment macros

For each Segment called by the ad tag, the Segments macros will be populated with that Segment's characteristics and data fields.

Each Segment fetched by the creative is are identified by number (starting with 1), so a macro for the first Segment would start with $D{S1_ and a macro for the second Segment would start with $D{S2_, and so forth. The following macro examples all use the first Segment ($D{S1_*).

Macro Description
$D{NUM_ITEMS} The number of Segments fetched by the creative, as set by the "numItems" param in the ad tag. Defaults to "1."

This macro is useful for Javascript that adapts to the number of Segments a creative has fetched (e.g., how many times to loop an animation).
$D{S1_ *} Insert the ALL CAPS name of an available data field. For example, the 'title' data field of the third Segment would be accessed using the macro $D{S1_TITLE}.
$D{S1_CLICK_URL_COMPLETE} A concatenated value constructed in the following order:
$D{S1_URL_ENC_CLICK_URL_COMPLETE}, $D{S1_HTML_ENC_CLICK_URL_COMPLETE} Expands to URL- and HTML-encoded versions of the $D{S1_CLICK_URL_COMPLETE}, respectively.

Viewer-related macros

These macros respond to characteristics belonging to the specific viewer of the ad.

Macro Description
$D{INT_CODE} The ad viewer's Integration Code.
$D{REC} Expands to "1" if the ad viewer was successfully found in the Audience, "0" if the person was not found.
$D{PERS}  Expands to "1" if the ad creative was successfully personalized for the Viewer based on a valid stored attribute, "0" if the ad creative could not be personalized for the Viewer.

Note: When the $D{PERS} macro expands to "1" then the $D{REC} macro will always expand to "1".
$D{VIEWER_TSEG} The Tracking Group (if any) from the Viewer's Audience Profile.
$D{VIEWER_SUB_ENT} The Sub-Entity (if any) from the Viewer's Audience Profile.
$D{VIEWER_CUSTOM1}, $D{VIEWER_CUSTOM2}, $D{VIEWER_CUSTOM3} The Custom Values stored in the Viewer's Audience Profile.
$D{VIEWER_SUPER_SEGMENTS} Expands to JSON of the Super Segments stored in the Viewer's Audience Profile.

Custom macros

Custom Macros are helpful in trafficking multiple creative variants via different ad tags.

Macro Description
$D{CI_ *} Custom Values can be passed into the creative via ad tag params. If an ad tag param begins with "ci_" (see more here) it is treated as a Custom Value and can be accessed by its corresponding macro.

For example, if the ad tag contains the param + value pair of "ci_my_custom_message=Hello%20world", then the macro $D{CI_MY_CUSTOM_MESSAGE} would expand to "Hello world" within the ad creative.

Note: $D{CI_ *} macros without corresponding param + value pairs in the ad tag will remain unchanged in the ad creative code.
$D{HTML_ENC_CI_ *}, $D{URL_ENC_CI_ *}

Expands to HTML- and URL-encoded Custom Values, respectively.

$D{RI_1} through $D{RI_10} These are Reserved Custom Values. There are ten available macros. Values can be passed into the creative with the ad tag params "ri_1" through "ri_10".

If a Reserved Custom Value macro has been used, but no value has been passed into the ad tag, then the macro will collapse to be blank.
$D{HTML_ENC_RI_ *}, $D{URL_ENC_RI_ *} Expands to HTML- and URL-encoded Reserved Custom Values, respectively.

 

Contact us to learn more about the Canned Banners Dynamic Ads platform.

CONTACT US