⚙️ Publica Macros: Setup & Walkthrough
Publica macros allow you to dynamically insert metadata into ad requests, tracking URLs, and log events—whether you're using SSAI, CSAI, or hybrid setups. Macros act as placeholders that get replaced in real time with values like content titles, genres, campaign IDs, or device types.
This guide covers:
? What macros are and how they work
? The 4 macro types supported by Publica
? How to configure macros for use in URLs, events, and metadata fields
✅ Best practices to ensure correct macro resolution
? What Are Macros?
A macro is a variable that Publica replaces with a live value at runtime.
Think of it as a shortcut like {CONTENT_TITLE} or {DEVICE_TYPE}—these get replaced by values like "The Office" or "ConnectedTV" before the URL or event is processed.
For example:
Before (in your ad call):
https://ad.example.com/track?title={CONTENT_TITLE}&genre={CONTENT_GENRE}
After (during playback or request execution):
https://ad.example.com/track?title=The%20Office&genre=Comedy
? Macro Categories
1. ? General Macros
These are the most commonly used macros and cover content metadata, playback info, and device/environment data.
| Macro | Description | Example Output |
|---|---|---|
{CONTENT_TITLE} | Title of the video/program | The Office |
{CONTENT_GENRE} | Genre of the content | Comedy |
{ASSET_ID} | Unique asset ID | asset-123456 |
{DEVICE_TYPE} | Device type or category | SmartTV |
{LANGUAGE} | ISO 639-1 language code | en |
{YEAR} | Content release year | 2023 |
{EPISODE_NAME} | Episode or segment name | Pilot |
{CONTENT_RATING} | Age rating or parental classification | TV-14 |
? Refer to pages 1–3 of the attached documentation for the full macro list.
2. ? Campaign Macros
Use these macros to dynamically insert campaign-specific values into ad server calls, bid requests, or tracking URLs.
| Macro | Description |
|---|---|
{ADVERTISER_ID} | Unique advertiser ID |
{CAMPAIGN_NAME} | Human-readable name of the campaign |
{CREATIVE_ID} | Unique creative asset ID |
{LINE_ITEM_ID} | Line item ID from the ad platform |
These macros help track performance and link ad delivery to specific campaign attributes.
? Found at the bottom of page 4 in the macro documentation.
3. ? Incoming Macros
Use Incoming Macros when you need to send metadata from your own systems into Publica—such as data from a CMS, video player, or custom app.
Setup format (JSON):
{ "custom": { "content_title": "Stranger Things", "season": "3", "episode_number": "1" } }
Call the macro like this:
{INCOMING.CONTENT_TITLE}
Use cases:
Inject custom metadata that’s not natively handled by Publica
Extend content targeting beyond default macros
Pass dynamic user session values
? Incoming macro examples are provided on page 4.
4. ? Post-Bid Macros
These macros are resolved after an ad is selected (e.g., during impression tracking or reporting).
| Macro | Description |
|---|---|
{DEAL_ID} | Identifier for the winning PMP deal |
{BIDDER} | Name of the DSP or bidder |
{TRACKINGURL} | Impression tracking pixel, dynamically populated |
? Use Post-Bid macros to enhance analytics, connect auction data, or populate server logs.
?️ Example: Using Macros in a Tracking URL
Here’s a generic ad tag or pixel with embedded macros:
https://analytics.adserver.com/pixel?title={CONTENT_TITLE}&device={DEVICE_TYPE}&year={YEAR}
If the viewer is watching "The Office" on a Roku TV, this could resolve to:
https://analytics.adserver.com/pixel?title=The%20Office&device=ConnectedTV&year=2005
✅ Best Practices
1. Map custom data using INCOMING macros
If you're passing metadata from your CMS or player, inject it in your request payload and reference it via {INCOMING.KEY}.
2. Test with live playback or debugger tools
Use test streams or tag debuggers to confirm that macros are being resolved correctly.
3. Follow naming conventions
Avoid spaces and use lowercase with underscores:
✅ {INCOMING.CONTENT_TITLE}
❌ {INCOMING.Content Title}
4. Use macros in campaign rules and targeting
Macros can be used for:
Creative rotation based on
{CONTENT_GENRE}Language-based targeting with
{LANGUAGE}Filtering impressions by
{DEVICE_TYPE}
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article