Macros in links and pages
Which macros the tracker understands, what replaces them, and how values are encoded in links and in the code of hosted pages.
A macro is a name in curly braces that the tracker replaces with click data: {click_id}, {country}, {sub_id_1}. The list of macros is also available in the panel: Admin panel → Macros («Админ-панель → Макросы»); clicking a row copies the macro to the clipboard. Owners and admins can see this menu item.
Where macros work
- In the URL field of an external offer and an external landing page.
- In the Direct URL («Прямой URL»), HTML and Show text («Показать текст») stream actions.
- In the code of the main page of a hosted landing page or offer, when the tracker serves it via the campaign link or the offer click-through link: in
index.htmland in the HTML response ofindex.php. Other files and direct URLs are covered in the Where macros are not substituted section. - In S2S postback URLs. They have their own set of macros, see S2S postback to the source and Campaign and source S2S postbacks.
Syntax
The rules in this section apply to links, stream actions and page code.
| Notation | What it means | Example |
|---|---|---|
{name} | The value with encoding or escaping | {keyword} |
{_name} | The same value without encoding or escaping | {_keyword} |
{name:arguments} | A macro with arguments after the colon | {random:1,100} |
- A macro name starts with a Latin letter and consists of Latin letters, digits and underscores. A link parameter with a different name, for example
utm-term, does not become a macro. - An unknown macro stays in the text as is.
- A known macro without a value gives an empty string. For example,
{city}when the city was not detected. - A built-in macro takes priority over a link parameter with the same name.
Encoding and escaping
In links and in stream actions, the value is URL-encoded. The _ prefix inserts it as is.
Click keyword: red shoes & bags
https://offer.example.com/?kw={keyword} → ?kw=red+shoes+%26+bags
https://offer.example.com/?kw={_keyword} → ?kw=red shoes & bagsIn the code of a hosted page, the value is not URL-encoded but escaped according to where it is inserted:
- in markup and in attributes — as HTML;
- inside the
scripttag, inonclickand similar handlers, and injavascript:links — as a JavaScript string.
Put attribute values and JavaScript strings in quotes: a regular macro inserts data, not executable code.
<input type="hidden" name="subid" value="{click_id}">
<script>var geo = "{country}";</script>In page code, the _ prefix turns escaping off. Link parameter values are sent by the visitor, so {_sub_id_1} and similar macros will insert any text sent into the page, including tags and scripts.
IDs and entities
| Macro | What is substituted | Example |
|---|---|---|
{click_id} | Click ID. Aliases: {subid}, {visitor_code} | k3m9x2pq7wzt |
{campaign_id} | Campaign ID. Alias: {keitaro_campaign_id} | — |
{campaign_name} | Campaign name. Alias: {keitaro_campaign_name} | FB DE Nutra |
{campaign_alias} | Campaign alias from its link | abc1234 |
{stream_id} | Stream ID | — |
{offer_id} | Offer ID | — |
{offer_name} | Offer name | Keto DE |
{landing_id} | Landing page ID. Alias: {lander_id} | — |
{landing_name} | Landing page name. Alias: {lander_name} | Quiz v2 |
{ts_id} | Traffic source ID. Alias: {source_id} | — |
{traffic_source_name} | Source name | Facebook |
{affiliate_network_name} | Name of the offer's affiliate network | Network A |
{external_id} | Click ID on the ad network's side: the external_id slot in the source tokens | — |
The campaign, stream, offer, landing page and source IDs are substituted as a full identifier like 11111111-2222-3333-4444-555555555555, not as the #N number from the list.
Network, device, GEO
| Macro | What is substituted | Example |
|---|---|---|
{ip} | The visitor's IP address | 203.0.113.10 |
{user_agent} | User-Agent. Aliases: {ua}, {useragent} | Mozilla/5.0 … |
{country} | Two-letter country code. Alias: {country_code} | DE |
{region} | Region. Alias: {region_name} | California |
{city} | City | Berlin |
{isp} | ISP | — |
{connection_type} | Connection type. Empty for a regular connection | hosting, vpn, tor, proxy |
{device} | Device type. Alias: {device_type} | mobile, tablet, desktop, unknown |
{device_model} | Device model | — |
{os} | Operating system | Android |
{os_version} | OS version | 14 |
{browser} | Browser | Chrome |
{browser_version} | Browser version | 126.0.0.0 |
{language} | Browser language. Alias: {lang} | en |
{is_bot} | 1 if the click was identified as a bot, otherwise 0 | 0 |
{is_using_proxy} | 1 if the connection type is hosting, vpn, tor or proxy, otherwise 0 | 0 |
{referrer} | Referrer. Alias: {referer} | https://example.com/page |
{current_domain} | The domain the click came to | track.example.com |
Country, region and city come from the GEO databases, and the connection type comes from the IP2Proxy database.
Source and sub_id
| Macro | What is substituted | Example |
|---|---|---|
{source} | The source's placement or site | site123 |
{ad_campaign_id} | Ad campaign ID | 120210001 |
{creative_id} | Creative or ad ID | 120210045 |
{keyword} | Keyword | red shoes |
{sub_id_1} … {sub_id_30} | The value of the corresponding sub_id | adset_7 |
{parameter_name} | The value of any campaign link parameter | {utm_term} for ?utm_term=… |
These values come from the campaign link parameters. Source tokens move an ad network parameter into the right macro: the value is available by slot, for example {sub_id_3}, and by the token name — see Click processing order. If the parameter did not arrive, the default value from the campaign parameters is used, if one is set.
Without a value, {sub_id_N} and {keyword} give an empty string. {source}, {ad_campaign_id}, {creative_id} and a macro named after a parameter stay as text if the click has no such parameter.
Money and conversion
| Macro | What is substituted | Example |
|---|---|---|
{cost} | Click cost — see Campaign cost models | 0.05 |
{currency} | Cost currency | USD |
{revenue} | Conversion revenue | only in a postback |
{status} | Conversion status | only in a postback |
{tid} | Transaction ID | only in a postback |
In links and on pages, {revenue}, {status} and {tid}, as well as {profit} and {conversion_time}, give no values: at the moment of the click there is no conversion yet. {revenue}, {status} and {tid} get values in outgoing S2S postbacks. The set of postback macros is on S2S postback to the source.
Generators
| Macro | What is substituted | Example |
|---|---|---|
{random:1,100} | A random integer from the first to the second value inclusive | 57 |
{sample:a,b,c} | A random item from a comma-separated list | b |
{date:Y-m-d H:i:s} | Date and time in the given format | 2026-10-04 12:30:05 |
{timestamp} | Unix time in seconds | 1791117005 |
{random}without two numbers gives a number from 0 to 999999.{date}without a format usesY-m-d H:i:s. The time is in UTC.
Date format characters
Y— year, four digits:2026;y— two digits:26.m— month with a leading zero:04;n— without it:4.d— day with a leading zero:09;j— without it:9.H— hours in 24-hour format,i— minutes,s— seconds.O— time zone offset:+0000;P— with a colon:+00:00.T— time zone name:UTC.U— Unix time:1791117005.
Other characters are output as is. A backslash before a character keeps it as a letter: \Y gives Y.
Click-throughs and offer values
| Macro | What is substituted | Example |
|---|---|---|
{offer} | The click-through link from the landing page to the offer. Alias: {to} | href="{offer}" |
{offer:ID} | The click-through link to a specific offer of the stream. ID is the offer's full identifier | href="{offer:ID}" |
{offer_value:name} | The offer value with this name | {offer_value:price} |
{offer} and {offer:ID} are placed in the code of a hosted landing page — see From landing page to offer and multi-offer. Offer values are set with the values («значения») button in the offer list — see Offer values. A name the offer does not have gives an empty string.
Widgets
Widgets work only in the HTML code of a hosted page. The macro is replaced with a ready-made HTML block with styles and a script, so place it once in the markup, outside attributes, scripts and comments.
Phone mask
The {phone_mask} macro adds a phone mask to input fields named phone:
- picks the country by the visitor's IP; if the country is unknown, it uses the US;
- validates the number as it is typed and shows a message in the browser's language: en, ru, es, fr, de, it, pt, nl, pl, tr, uk. For other languages the text is in English;
- does not let the form be submitted with an invalid number;
- writes the country's phone code to the element with
id="phonecc", if there is one on the page.
The mask libraries load from external CDNs: cdnjs.cloudflare.com and code.jquery.com.
<form method="post">
<input type="tel" name="phone">
<input type="hidden" name="phonecc" id="phonecc">
<button type="submit">Submit</button>
</form>
{phone_mask}Form submit screen
When any form is submitted, the {form_loader} macro shows a screen over the page with a spinner and a text: the request has been sent, a manager will get in touch within a few minutes, and there is no need to close the page. No external files are loaded. The language of the text is chosen by the browser language: en, ru, fr, de, es, pt, it, nl, pl, sv, no. For other languages the text is in English.
Where macros are not substituted
- In
.css,.jsand other files except HTML. Pass a value for a script through a variable in the HTML file, as in the example in the Encoding and escaping section. - In a PHP response that is not HTML.
- On pages opened at the direct URL
/_l/<ID>/…or/_o/<ID>/…: with the Preview («Просмотр») and Open ↗ («Открыть ↗») buttons, and when going from the main page to another file of the archive, for examplethanks.html. There is no click in such a request. In.htmland.htmfiles, only macros without arguments whose name matches a URL parameter, and widgets, are replaced; other macros stay as text. Nothing is substituted into a PHP response.
To pass a value to the second page of the archive, add it to the link as a parameter:
<a href="thanks.html?click_id={click_id}">Next</a>CSS and JavaScript curly braces in page code are not changed as long as their content does not match a macro name. An entry without spaces, for example {status} or {ip}, will be replaced.
How hosted pages are served and how a direct URL differs from a campaign link is described on Hosted pages.