Moclick Bridge
Integration

Postback S2S

The conversion reported by the advertiser's backend, authenticated by token. No JavaScript, no cookie, no browser.

When to use it#

Server-to-server postback is the most reliable way to record a conversion, because it does not depend on anything happening in the browser. Cases where it is the right answer:

  • Checkout on a third-party domain, where the cookie does not survive
  • Conversion confirmed after the order — payment approved, bank slip cleared, subscription activated
  • Conversion that happens off-site: phone, messaging app, physical store, CRM
  • An advertiser that cannot or will not install third-party JavaScript
  • Environments with aggressive script blocking

The postback URL#

The Moclick team provides the full URL and the campaign token. The token is generated automatically per campaign and is never reused across campaigns.

GET /wp-json/moclick/v1/postback Token
Format
https://bridge.moclick.com.br/wp-json/moclick/v1/postback
  ?slug=YOUR-CAMPAIGN
  &token=YOUR-TOKEN
  &click_id={CLICK_ID}
  &txid={TXID}
  &value={VALUE}
ParameterRequiredDescription
slugYesCampaign identifier.
tokenYesCampaign token, provided by Moclick.
click_idYesClick identifier, up to 100 characters. Without it nothing is recorded.
txidRecommendedTransaction identifier, up to 100 characters. This is the deduplication key.
valueRecommendedConversion value. Dot as the decimal separator.

How the advertiser gets the click_id#

The identifier has to reach the advertiser’s backend and be stored alongside the order. If the global tag is installed it is already in a cookie — read it server-side when writing the order:

PHPin the advertiser’s backend
// The Moclick team tells you the cookie name for your campaign.
$click_id = $_COOKIE[MOCLICK_COOKIE] ?? '';

// Store it with the order, to use when the conversion is confirmed
save_order_meta($order_id, 'moclick_click_id', $click_id);

Without the global tag, capture the identification parameter on entry and persist it in the session. The Moclick team tells you which parameter the campaign uses.

Example call#

Shell
curl -sS -G "https://bridge.moclick.com.br/wp-json/moclick/v1/postback" 
  --data-urlencode "slug=my-campaign" 
  --data-urlencode "token=YOUR_TOKEN" 
  --data-urlencode "click_id=abc-123" 
  --data-urlencode "txid=ORDER-9001" 
  --data-urlencode "value=249.90"

Responses#

CodeBodyMeaning
200 OK as text/plain Received. This includes the duplicate case, which is a success by design.
403 {"error":"invalid_token"} Invalid token, missing token or non-existent campaign.
Why all three cases return the same 403

A wrong token, an empty token and a non-existent campaign produce an identical response, and the token is compared in constant time. That keeps the response from revealing which campaigns exist, and blocks token discovery through timing measurement.

One detail that saves confusion: 200 OK confirms receipt, not necessarily a write. A request with no click_id, or one for a campaign that does not use Moclick’s own measurement, answers OK without recording anything — the same silent policy as the other endpoints. When integrating, confirm in the dashboard that the event actually showed up.

Retries and idempotency#

The call is idempotent on the click_id + txid pair: repeating the same request never creates a duplicate conversion. That makes retrying safe, and retrying is recommended.

Never drop a conversion on a network failure

Treat the postback as a queue, not as a single call. A timeout or a 5xx error should go into a retry with progressive backoff — for example 1 min, 5 min, 30 min, 2 h. Since the operation is idempotent, there is no risk in trying again. A 403, on the other hand, should never be retried: it is a configuration error, and resending will not fix it.

Token security#

  • Keep the token on the server. Never in JavaScript, HTML or a mobile app
  • Store it in an environment variable or a secrets vault, not in the repository
  • One token per campaign: compromising one does not expose the others
  • Whoever holds the token can insert conversions into that campaign — treat it as a credential

The postback URL contains the token. Do not publish it in shared documentation, a support ticket, a public access log or a repository. If a token leaks, ask the Moclick team for a new one and update the integration.

Atualizado em agosto 5, 2026