Skip to main content
Universal macros enable buyers to include dynamic tracking data in their creatives without needing to know each publisher’s ad server implementation details. Macros are placeholders that get replaced with actual values at impression time.

Overview

When you provide creative assets to AdCP, you can include universal macro placeholders in:
  • Impression tracking URLs
  • Click tracking URLs
  • VAST tracking events
  • Landing page URLs
Example:
At impression time, this becomes:

Available Macros by Format

Different creative formats support different macros. Use list_creative_formats to see which macros are available for each format.

Common Macros (All Formats)

Privacy & Compliance Macros

Critical for regulatory compliance - Use these to respect user privacy choices in your creative logic.
Privacy Warning: {IP_ADDRESS} is considered personal data under GDPR and many privacy regulations. This macro may return an empty string or masked/truncated IP depending on user privacy settings, publisher policies, and regional regulations. Use geo macros ({COUNTRY}, {REGION}, {CITY}) instead when possible.
Example - Privacy-aware tracking:

Device & Environment Macros

Geographic Macros

Identity Macros

Web Context Macros

For web-based inventory:

Placement & Position Macros

Video Content Macros

For video formats with content context:

Video Ad Pod Macros

For video ads in commercial breaks: Note: Video formats also support all IAB VAST 4.x macros like [CACHEBUSTING], [TIMESTAMP], [DOMAIN], [IFA], etc. These work natively in VAST XML.

Audio Content Macros

For audio formats with content context:

TMP Exposure Tracking

The {TMPX} macro carries an encrypted exposure token from the Identity Match response. It contains the user’s resolved identity tokens encrypted via HPKE, enabling the buyer’s impression pixel to log per-user exposures for real-time frequency capping. Publishers substitute {TMPX} into tracking URLs exactly like other macros. The token is opaque — publishers MUST NOT parse, log, or make decisions based on its value. See TMPX Exposure Tokens for the encryption format and key management.

AXE Integration (Legacy)

The {AXEM} macro is from the legacy AXE integration. In TMP, this is replaced by:
  • Structured creative assets move to the creative_manifest field on the Offer.
  • Per-user exposure tracking uses the {TMPX} macro from Identity Match.

Catalog Item Macros

For catalog-driven creatives (carousels, dynamic product ads, job boards, store locators). These macros resolve to the identifier of the specific catalog item being rendered at serve time — the same identifiers used in conversion event content_ids via the content_id_type field. Use the macro that matches your catalog’s content_id_type. For example, a product catalog with content_id_type: "gtin" uses {GTIN} in tracker URLs; a job catalog uses {JOB_ID}.

Substitution safety (catalog-item macros)

Catalog-item macros are the one macro class where the value originates in buyer-controlled data (the catalog feed) and expands at impression time into publisher-controlled contexts (impression tracker URLs, click tracker URLs, VAST tracking-event URLs, AND landing / clickthrough URLs — the full set of URL substitution targets above). That flow is attacker-adjacent: a catalog value containing &, #, ?, CR/LF, a stray URL fragment, or a Unicode bidi override can break out of the URL context, inject a Host-header via CRLF, or spoof audit-log rendering if substituted raw. The following rules apply to all catalog-item macros listed above ({CATALOG_ID}, {SKU}, {GTIN}, {OFFERING_ID}, {JOB_ID}, {HOTEL_ID}, {FLIGHT_ID}, {VEHICLE_ID}, {LISTING_ID}, {STORE_ID}, {PROGRAM_ID}, {DESTINATION_ID}):
  • Normalize to Unicode NFC before encoding. Prior to percent-encoding, catalog-item values that are not already in Unicode Normalization Form C (NFC) MUST be normalized to NFC per Unicode Standard Annex #15. Sellers and buyers MAY send catalog values in any normalization form at sync_catalogs ingest (the catalog is stored as-supplied); the normalization to NFC is a step in the substitution pipeline immediately before percent-encoding, not a catalog-ingest requirement. Without this step, two implementations that both satisfy the unreserved-whitelist rule below produce different bytes for the same visual string — café (NFC: U+00E9) and cafe\u0301 (NFD: U+0065 + combining U+0301) encode to caf%C3%A9 vs e%CC%81 respectively. NFC matches web-platform convention (WHATWG URL, HTML5 DOM, W3C Character Model). NFKC / NFKD are not acceptable substitutes — their compatibility folding silently mutates fullwidth/halfwidth variants and other visually-distinct glyphs that legitimately appear in Japanese/Korean retailer catalogs.
  • Percent-encode every octet that is not in the RFC 3986 unreserved set. Sales agents MUST percent-encode the NFC-normalized catalog-item value such that only RFC 3986 unreserved characters (ALPHA / DIGIT / "-" / "." / "_" / "~") remain unescaped before substituting it into a URL context (query string, path segment, or fragment). Non-ASCII octets MUST be percent-encoded after UTF-8 encoding per RFC 3986 §2.5. This is the encodeURIComponent-equivalent contract: reserved characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) are escaped as one would expect, but so are CR (%0D), LF (%0A), space (%20), C0/C1 control characters, and Unicode bidi overrides — the broader enumeration closes CRLF-injection and bidi-spoofing vectors that a reserved-only rule would leave open. Encoding is applied exactly once at substitution time; downstream VAST players and ad servers firing the URL verbatim is the expected contract — they do not and MUST NOT re-decode before firing.
  • Nested macro expansion is prohibited. A catalog-item value that itself contains text matching AdCP’s {MACRO_NAME} syntax MUST NOT be re-expanded. Sales agents perform AdCP macro substitution in one pass: source placeholders are replaced with literal values, and those literal values are not re-scanned. A {JOB_ID} value of vacancy-{DEVICE_ID}-42 produces the literal string vacancy-%7BDEVICE_ID%7D-42 (after percent-encoding of the braces) in the emitted URL, not a second-round expansion. This rule binds AdCP’s {...} syntax only; catalog-item values containing downstream ad-server macro syntaxes (%%...%%, ${...}, [...], {{...}}) remain the sales agent’s responsibility to neutralize when targeting an ad server that would interpret them — percent-encoding per the rule above typically suffices, since %, $, [, ], and { all land outside the unreserved set.
  • Scope is URL contexts only. These rules apply when a catalog-item macro is substituted into a URL context. When a catalog-item macro is substituted into an HTML-attribute context (for example, a banner template’s href or data-* attribute rendered server-side), percent-encoding per this section does not by itself prevent attribute-context breakout; the renderer MUST additionally apply HTML-attribute escaping — the two encodings are layered, not alternatives, because the value must survive both the URL parser and the HTML attribute parser. AdCP’s normative contract bounds to the URL-context case; publisher-side HTML-attribute handling is out of scope for this spec.
Non-catalog macros ({MEDIA_BUY_ID}, {PACKAGE_ID}, {CREATIVE_ID}, {GEO}, {COUNTRY}, {DEVICE_TYPE}, etc.) are populated from publisher- or ad-server-mediated state, not from buyer-supplied feed data. Their encoding contract is governed by the ad-server integration (OpenRTB, VAST), which percent-encodes by convention. Some macros in this class derive from attacker-spoofable inputs ({USER_AGENT}, {REFERRER}, {PAGE_URL}, {DOMAIN}, {APP_BUNDLE} come from request headers or page metadata); the OpenRTB / ad-server encoding convention is the control today. This spec’s normative MUST deliberately scopes to the buyer-controlled catalog-item class — a narrower, verifiable contract than a universal canonicalization rule. Conformance fixture. Reference test vectors pinning the encoding behavior — reserved-character breakout, nested-expansion literal preservation, CRLF injection, non-ASCII — are tracked at static/test-vectors/catalog-macro-substitution.json. Sales agents SHOULD validate their substitution code against these vectors before shipping.

Creative Variant Macros

Note: Publisher-specific custom macros may be defined in individual creative format specifications as extra supported macros.

Usage Examples

Video Creative with Tracking

Key Points:
  • Mix AdCP macros ({MEDIA_BUY_ID}) with VAST macros ([CACHEBUSTING])
  • AdCP macros use {CURLY_BRACES}
  • VAST macros use [SQUARE_BRACKETS]
  • Both work together seamlessly

Display Creative with Tracking

Audio Creative with Tracking

Catalog-Driven Creative with Item Tracking

Key point: {GTIN} resolves to the specific product’s GTIN at serve time. For a carousel showing 5 products, each product impression/click fires with that product’s identifier — enabling per-item attribution.

Macro Availability by Inventory Type

Not all macros are available in all inventory types. Check format specifications to see which macros are supported. Important: The columns below represent format types (Display, Video, etc.) which can run in different environments (app vs web). For example:
  • Display ads in mobile apps have DEVICE_ID (✅*), but display ads on web do not
  • The ✅* notation means “available in-app contexts only”
  • Format type + inventory environment determine actual macro availability
Legend:
  • ✅ = Available
  • ❌ = Not available
  • ✅* = In-app only (not mobile web)
  • ✅† = When location permission granted
  • ✅‡ = Often restricted due to privacy regulations (may return empty or masked value)
  • ✅§ = DOOH uses play-log-based reporting rather than pixel URLs
Important Notes:
  • Privacy macros ({LIMIT_AD_TRACKING}, {DEVICE_ID}) may return empty values based on user privacy settings
  • Geographic macros accuracy varies by publisher’s data capabilities
  • {PLACEMENT_ID} refers to the IAB Global Placement ID standard

How Macros Work

1. Discovery

Query list_creative_formats to see which macros each format supports:

2. Include Macros in Creatives

Add macro placeholders in your tracking URLs using {MACRO_NAME} syntax:

3. Sales Agent Processing

When you create a media buy via create_media_buy, the sales agent:
  1. Replaces AdCP ID macros with your actual IDs:
    • {MEDIA_BUY_ID}mb_spring_2025
    • {PACKAGE_ID}pkg_ctv_prime
    • {CREATIVE_ID}cr_video_30s
  2. Translates platform macros to their ad server’s syntax:
    • {CACHEBUSTER}%%CACHEBUSTER%% (GAM) or {{timestamp}} (Kevel)
    • {DEVICE_ID}%%ADVERTISING_IDENTIFIER_PLAIN%% (GAM)
    • {DOMAIN}%%SITE%% (GAM)
  3. Inserts click trackers automatically into clickable elements
  4. Leaves VAST macros unchanged (for video formats)

4. Impression Time

The publisher’s ad server replaces remaining macros with actual values:

Best Practices

Use Macros Consistently

Include the same core set of macros across all your creatives:
This makes your tracking data consistent and easier to analyze.

Check Format Support

Always query list_creative_formats to see which macros are available. Not all formats support all macros.

Combine VAST and AdCP Macros

For video, use both systems together:
  • VAST macros [CACHEBUSTING], [TIMESTAMP] - for standard video tracking
  • AdCP macros {MEDIA_BUY_ID}, {DEVICE_ID} - for your campaign tracking

Privacy Compliance

Critical: Always respect user privacy choices in your creative logic.

GDPR Compliance (EU Traffic)

For campaigns serving in the EU:

US Privacy / CCPA Compliance

For US traffic:

Device-Level Privacy

Respect Limit Ad Tracking settings:

Privacy Macro Behavior

Empty Values: Privacy-restricted macros return empty strings or zeros:
  • {DEVICE_ID}"" or 00000000-0000-0000-0000-000000000000 when LAT enabled
  • {GDPR_CONSENT}"" when no consent provided
  • {IP_ADDRESS}"" or masked/truncated IP when privacy restricted
Always test for empty values before using privacy-sensitive macros.

URL Encoding

No need to URL-encode macro placeholders. The ad server handles encoding of actual values automatically. Example:
The ad server will URL-encode the actual value when replacing the macro.

Template Syntax

AdCP macro-bearing URLs validate as RFC 6570 URI templates (Level 1) — simple {var} substitution only. Level 2–4 operators ({+SKU}, {#SKU}, {.SKU}, {/SKU}, {;SKU}, {?SKU}, {&SKU}) are not used by AdCP and must not appear in manifests. The ad server performs literal string replacement, not RFC 6570 expansion.

Implementation Notes for Sales Agents

This section is for AdCP implementers, not buyers.

Macro Translation Approach

Sales agents must translate universal macros to their ad server’s native syntax. The recommended approach: Option 1: Hard-Code During Trafficking (MVP)
  • When creating ad server creatives, replace AdCP ID macros with actual values
  • Translate platform macros to ad server syntax
  • Creates one creative per line item but is simple and reliable
Option 2: Dynamic Wrapper (Future)
  • Intercept ad calls and inject values dynamically
  • More complex but avoids creative duplication

Translation Examples

Google Ad Manager:
Kevel:
Xandr Monetize:

Click Tracker Insertion

Sales agents must automatically insert click tracking macros into clickable elements: Original creative:
After insertion (GAM):

Mapping Storage

Store the mapping between AdCP IDs and ad server IDs for reconciliation:
Return this in create_media_buy responses and make it queryable for reconciliation.