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 ten pass-through slots, sub1 to sub10. 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.

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.

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}{sub10}Your ten sub IDs
{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.