Keitaro Macros: The S2S Postback and Sub ID Reference
As a vocabulary, Keitaro macros drive every S2S postback: each URL you configure is a template, and at send time the tracker substitutes placeholders - {external_id}, {conversion_revenue}, {status} - with the actual values of the conversion. Used deliberately, they turn one postback row into a complete, self-describing delivery; used carelessly, they produce empty parameters and unmatched conversions. This reference collects the documented macros in working groups, plus the sub ID fields and the encoding rules that keep everything intact. The full setup procedure lives in the S2S postback setup guide; here it is table-first.
All rows below follow Keitaro's placeholders documentation (S2S postback placeholders).
Identifiers
| Macro | Meaning |
|---|---|
{subid} | The subid |
{external_id} | External ID passed in from the traffic source - the click ID carrier |
{tid} | Transaction ID |
{visitor_code} | Unique visitor code |
The click ID carrier deserves the emphasis: an empty {external_id} in a sent postback means the source never passed its parameter, and no configuration below the click can repair it.
Money: Revenue, Cost, Profit
| Macro | Meaning |
|---|---|
{revenue} | Conversion revenue |
{revenue:currency,percent} | Revenue in a chosen currency at a percent, e.g. {revenue:USD,70} (converted) |
{conversion_revenue} | Revenue of the conversion |
{conversion_cost} | Cost attributed to the conversion |
{conversion_profit} | Profit of the conversion, cost deducted |
{profit} | Profit value - revenue minus cost |
{cost} | Click cost |
Monetary macros accept a currency parameter that converts from the tracker's currency: {conversion_revenue:eur} sends the value converted to euros.
Statuses - and Renaming Them per Destination
| Macro | Meaning |
|---|---|
{status} | Conversion status |
{status:mapping} | Status with a mapping, e.g. {status:lead=0 sale=1 rejected=2}; custom mappings like {status: lead=install sale=bill rejected=trash} are supported |
The mapping form is how one tracker vocabulary feeds many destinations: your records keep lead and sale, while the destination sees install or bill.
Timestamps
| Macro | Meaning |
|---|---|
{date:format,timezone} | Click date - UTC by default, e.g. {_date:Y-m-d H:i:s,Europe/Kyiv} |
{conversion_time:format,timezone} | Conversion date/time, e.g. {_conversion_time:Y-m-d H:i:s,Europe/Kyiv} |
Campaigns, Offers, Sources
| Macro | Meaning |
|---|---|
{campaign_id} (alias keitaro_campaign_id) | Campaign ID |
{campaign_name} (alias keitaro_campaign_name) | Campaign name |
{campaign_alias} | Campaign alias |
{ad_campaign_id} | Ad campaign ID |
{creative_id} | Creative ID |
{landing_id} | Landing ID |
{offer_id} | ID of the offer |
{offer_name} | Name of the offer (works with the Before click selection in multioffers) |
{offer_value:NAME} | Pulls a parameter from an offer's additional Values settings |
{stream_id} | Flow ID |
{parent_campaign_id} | Previous campaign via Send to campaign |
{ts_id} | ID of the traffic source |
{traffic_source_name} | Name of the traffic source |
{affiliate_network_name} | Affiliate network name |
{sub_id_1} - {sub_id_30} | The thirty sub ID parameters |
{source} | Site (formerly called source) |
The sub ID fields deserve their own note: on the incoming postback side, the same sub_id_1..sub_id_30 are documented as "extra data to update the click record" (postback URL) - which is exactly why they are the natural home for offer labels in offer rotation tracking.
Geo, Device, Network
| Macro | Meaning |
|---|---|
{country} (alias country_code) | Country code |
{country:lang} (alias country_name) | Country name in the given language |
{region:lang} (alias region_name) | Region name; empty lang returns the region code |
{city} | City name |
{isp} | ISP |
{ip} | IP address |
{browser} / {browser_version} | Browser name and version |
{os} / {os_version} | Operating system and version |
{device_model} | Model of the device |
{device_type:lang} | Type of the device |
{language} | ISO 639-1 language code |
{user_agent} (aliases ua, useragent) | Browser user agent |
{connection_type:lang} | Connection type |
{is_bot} | Yields 1 for bots |
{is_using_proxy} | Flags 1 for proxies |
Other Placeholders
| Macro | Meaning |
|---|---|
{keyword:charset} | Keyword with encoding, e.g. {keyword:UTF-8} |
{search_engine} (alias se) | Value of the se parameter |
{referrer} (alias referer) | Referrer |
{destination} | Landing URL, offer URL, flow redirect URL, or flow text |
{current_domain} | Current tracker campaign domain |
{random:min,max} | Random number within the range |
{sample:val1,val2,valN} | One value at random |
{from_file:file} | Loads content from the file var/macros/file |
Usage Rules: Encoding and Currencies
Two documented rules prevent most broken postback URLs:
- Encoding. Placeholder values are encoded by default; prefix the macro with an underscore for raw output -
{_text}style - when the destination needs the unescaped value. - Currency conversion. Monetary macros accept a currency parameter converting from the tracker's currency:
{conversion_revenue:eur}.
And the acceptance test stays the same as everywhere in the cluster: one real conversion through the chain, then the S2S log (logs) showing every placeholder resolved to a non-empty value. The failure signatures and their fixes are in the setup guide.
Keitaro Macros: Frequently Asked Questions
Frequently asked questions
Sources
Sources
- Verify each mapped URL: Pixel Activator fires free test events the moment placeholders change.
- Templates kept honest: Most delivers every conversion with its full placeholder set resolved.
