← All articles
7 min read

How to Set Up a Postback URL (Step-by-Step)

A practical walkthrough for setting up your first postback URL: building the endpoint, picking macros, testing, and avoiding the mistakes that break attribution.

Setting up your first postback URL feels intimidating until you realize it's just three things: an endpoint, a click ID, and the right macros. Here's the playbook.

Step 1 — Decide what you want to track

Most affiliates want confirmed sale events with payout. Some also want leads or trial signups. Pick one event per postback — don't try to multiplex.

Step 2 — Build your tracking endpoint

You can roll your own (a single HTTPS handler that reads query params and forwards to ad platforms) or use a forwarding service. The endpoint must:

  • Be HTTPS — most networks reject HTTP postbacks.
  • Return a 2xx status quickly. Long-running work belongs in a background queue.
  • Accept idempotency keys (use the order ID) so a retried postback can't double-count.

Step 3 — Pass the click ID as a SubID

When the user clicks your ad, capture fbclid, gclid, or ttclidfrom the URL. Append it to your affiliate link as the network's SubID parameter:

https://merchant.example/?irclickid=...&subId1={fbclid}

The network stores that SubID against the click. On conversion, it sends it back in the postback.

Step 4 — Configure the postback URL in the network

Use macros the network supports. A typical Impact-style postback:

https://yourdomain.com/p?click_id={SubId1}&payout={Payout}&order_id={OID}&currency={Currency}

Step 5 — Forward to the ad platform

Inside your endpoint, take the click ID and call the right ad-platform API:

  • Meta: Conversions API (/events) with fbc built from fbclid.
  • Google Ads: Offline Conversion Upload with gclid + conversion time.
  • TikTok: Events API with ttclid.

Step 6 — Test before you launch

Most networks have a "fire test postback" button. Use it, watch your logs, confirm the click ID arrives, and check the ad platform's test events view shows the event.

Common mistakes

  • Forgetting to URL-encode the SubID — the click ID gets mangled in transit.
  • Using a single SubID slot for two different click IDs — they overwrite each other.
  • Returning a 500 from the endpoint — networks retry, then disable the postback.
  • Not deduplicating on order ID — refunds + retries can double-fire.

If you don't want to build the forwarding endpoint yourself, that's exactly what AffPixel does.