Appfiliate Docs
appfiliate.io

Record Click

Records a link click when a user taps a tracking link. This endpoint is called by the Cloudflare redirect worker, not directly by the SDK.

POST/v1/click

Records a link click and returns a click ID. The redirect worker calls this before sending the user to the app store.


Request Body

ParameterTypeRequiredDescription
link_idstringRequiredThe tracking link ID or short code. If a short code is passed, it is automatically prefixed with "link_".
app_idstringOptionalThe app ID this link belongs to.
ipstringOptionalThe user's IP address. Falls back to the request IP if not provided.
user_agentstringOptionalThe user's browser user-agent string. Used for device fingerprinting during attribution.
accept_languagestringOptionalThe Accept-Language header from the user's browser.
refererstringOptionalThe HTTP referer. Defaults to "direct" if not provided.
platformstringOptionalThe detected platform (e.g. "ios", "android"). Defaults to "unknown".
countrystringOptionalTwo-letter country code derived from the request (e.g. from Cloudflare headers).
tls_fingerprintstringOptionalTLS JA3/JA4 fingerprint from the Cloudflare Worker, used for additional matching signals.

Example Request

curl
curl -X POST https://us-central1-appfiliate-5a18b.cloudfunctions.net/api/v1/click \
  -H "Content-Type: application/json" \
  -d '{
    "link_id": "abc123",
    "app_id": "app_myapp",
    "ip": "203.0.113.42",
    "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X)",
    "accept_language": "en-US,en;q=0.9",
    "referer": "https://instagram.com",
    "platform": "ios",
    "country": "US"
  }'

Response

Returns the generated click ID on success.

200 OK
{
  "click_id": "m1abc123_x9f2k4p1"
}

Error Response

500 Internal Server Error
{
  "error": "Failed to record click"
}

Infrastructure endpoint

This endpoint is designed to be called by the Cloudflare redirect worker, not directly by app code or the SDK. The worker extracts request metadata (IP, user-agent, language, referer) and forwards it along with the link ID.

How It Works

The user-agent string is parsed server-side to extract the device model, OS version, and browser. These fields are stored alongside the click and later used for probabilistic fingerprint matching during attribution. The click is initially stored with is_matched: false and is updated to true once an install is attributed to it.