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. 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.

AXE Integration

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

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
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 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.

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.