Skip to content

Traffic sources & macros

A traffic source records how one platform talks to you: what it calls each sub ID, and how it reports cost.

A Facebook source comes ready-made with its macros already filled in — see Facebook integration. Every other platform you add yourself.

Sub IDs

Roitrack gives you twenty pass-through slots, sub1 to sub20. For each one you can set:

  • Name — the label shown in reports, e.g. Placement instead of sub4
  • Placeholder — the macro that source substitutes, e.g. {placement}

Naming them is what turns an unreadable report into a useful one. sub4 = 118823 tells you nothing; Placement = 118823 tells you what to exclude.

The placeholder is the token your traffic source replaces when it builds the URL. Every platform spells these differently — Facebook’s {{placement}}, TikTok’s __PLACEMENT__, a self-serve DSP’s [placement] — so copy them from that platform’s own macro documentation.

Cost

The cost macro is the token your source substitutes with what the click cost you, commonly {cost} or {cpc}.

Per campaign, Count cost decides whether cost from the URL is recorded. Turn it off when you’re reconciling spend manually or the source doesn’t report per-click cost — otherwise ROI is computed against a cost of zero and every campaign looks profitable.

Beside it, CPC and CPM say what the number in that macro means. CPC — the default, and what every campaign created before this option existed uses — treats it as the price of that one click. CPM treats it as the price of a thousand impressions, so the click is recorded at a thousandth of it: a source sending cost=2.50 on a CPM campaign books $0.0025 against the click. Pick the one your source actually quotes; picking the wrong one is out by a factor of a thousand in whichever direction.

This applies only to the value arriving in the URL. Costs you enter under Update Cost, or pull from the Facebook Marketing API, are already real amounts and are stored as they are.

Facebook has no cost macro at all, so on campaigns using the built-in Facebook source the setting is switched off and disabled. Pull spend from the Marketing API instead — see Facebook integration.

Campaigns generate a link like:

https://your-tracking-domain.com/click/<token>

Append the parameters your source fills in:

https://your-tracking-domain.com/click/<token>?sub1={campaign_id}&sub2={adset_id}&sub4={placement}&cost={cpc}

That’s the URL you paste into the ad platform.

External ID

Most networks give each click an ID of their own and a macro to pass it with — {eid}, ${SUBID}, {externalid}, whatever that network calls it. Put their macro in External ID Macro on the traffic source and it is appended to your campaign link as external_id=…, the same way the cost macro is appended as cost=….

It has its own field rather than a sub slot for two reasons: it costs you nothing from your twenty subs, and it never appears as a report grouping, where it would be useless — every click has a different one, so grouping by it gives one row per click.

Send it back on the conversion postback as {external_id}. That is the ID the network’s optimiser knows the click by; your click ID means nothing on their side, so a postback without it tells them a conversion happened but not which click caused it.

Leave it empty if the network has no such macro — the link then carries no external_id at all.

Macros available on the way out

Use these in an offer URL or a network template. Roitrack substitutes them at redirect time:

MacroValue
{click_id}The click ID — pass this one, or postbacks can’t attribute
{campaign_id}Campaign identifier
{offer_id}Offer identifier
{cost}Click cost, four decimal places
{sub1} … {sub20}Your twenty sub IDs
{external_id}The traffic source’s own ID for the click
{offer_url}The offer’s own URL — only meaningful inside a network template

A typical offer URL:

https://network.com/offer/123?aff_sub={click_id}&aff_sub2={sub1}

{click_id} is the one that matters. Whatever you send here is what must come back in the postback’s click_id. See Postbacks & conversions.

Network templates

Set a template on an affiliate network and every offer under it inherits the same parameters, instead of you editing dozens of offer URLs by hand.

Templates use {offer_url} as the placeholder for the offer’s own URL:

{offer_url}?aff_sub={click_id}&aff_sub5={sub3}

When a template and an offer URL both set the same parameter, the offer wins. That’s deliberate: the template carries your defaults, and an individual offer can override one without you cloning the template.

Checking it works

Open your tracking link with test values:

https://your-tracking-domain.com/click/<token>?sub1=test1&sub4=testplacement&cost=0.25

You should land on the offer. Then check two things:

  1. The final URL in your browser’s address bar contains the substituted values — that proves the outbound macros fired.
  2. The click log shows a row with sub1 = test1 and cost 0.25 — that proves the inbound parameters were recorded.

If the first works and the second doesn’t, your link is fine and the report is lagging a moment. If the second works and the first doesn’t, you recorded the sub IDs but never forwarded them, and your network won’t be able to report on them.