Skip to content

Macros ​

A macro is a word in curly braces in a link, for example {click_id}. When a user clicks an ad, the platform replaces the macro with a value and only then opens your page. This is how the click ID, campaign ID, source ID and device data get into your tracker or analytics.

Where to use them ​

Macros work in two fields:

  • Target URL in the campaign settings;
  • the landing page field in a creative: Target URL: for native, Push and Pop creatives, Landing page: for banners and video creatives. If the creative has Matches URL in advertising campaign settings selected (Matches URL in campaign settings for banners and video), the campaign link is used.

Under each of these fields there is an Available macros list. Clicking a macro inserts it into the field.

Macro list ​

MacroWhat is insertedExample valueWhen empty
{click_id}Click ID: a unique 36-character string. The tracker returns the same string in the postbackA server notification about a conversion that a tracker sends to the platform.3f1c9a2e-5b7d-4c1a-9e2f-0a1b2c3d4e5fAlways filled
{campaign}Campaign ID1038Always filled
{creative}Creative ID7712Always filled
{zone_id}Where the impression was served: the traffic source ID and the ID of the ad slot within that source, separated by a colon. The value is URL-encoded, so the colon is passed as %3A1201%3Aa7f3c9The ad slot ID can be empty: 1201%3A
{cpc}Cost per click in your account currency, four decimal places. For Pop with pay per impression: the price of one impression0.0500With pay per impression (CPM) in all formats except Pop
{language}User language: two lowercase Latin lettersdeThe language was not detected
{device}Device type: mobile, tablet, pc, ctv (Smart TV) or botmobileThe type was not detected
{browser}Browser: Chrome, ChromeMobile, Safari, Firefox, Edge, Opera, YandexBrowser, SamsungInternet and othersChromeMobileThe browser was not detected
{platform}Operating system: android, ios, windows, macos, linux or symbianandroidThe OS was not detected
{random}A random 8-character string: Latin letters, digits, _ and -. New on every click. Helps bypass the tracker cache. The Available macros list labels it "Generation of a random number", but the value is a stringaZ3_kP9xAlways filled
{sub_age}Push only: how many days ago the user subscribed to notifications120 if the source did not pass the subscription age or the format is not Push

The {sub_age} macro appears in the Available macros list only for Push campaigns and Push creatives.

Example ​

The link in the Target URL field:

text
https://example.com/sale?click_id={click_id}&campaign={campaign}&source={zone_id}&os={platform}

What your site receives after a click:

text
https://example.com/sale?click_id=3f1c9a2e-5b7d-4c1a-9e2f-0a1b2c3d4e5f&campaign=1038&source=1201%3Aa7f3c9&os=android

Rules ​

  • Write the macro exactly as in the list. Case matters: {Click_ID} is not replaced. An unknown macro, for example one with a typo, stays in the link as is.
  • Put macros in parameter values after ? and &, as in the example. Values other than {zone_id} and {language} are inserted without encoding.
  • You need {click_id} to track conversions. The tracker must store it and return it unchanged in the postback. A conversion counts if it arrives no later than 60 days after the click. For details, see Set up postback and conversion tracking.
  • You do not need platform macros in the postback link. Your tracker fills it in with its own macros.

© Youtarget