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.
/v1/clickRecords a link click and returns a click ID. The redirect worker calls this before sending the user to the app store.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
link_id | string | Required | The tracking link ID or short code. If a short code is passed, it is automatically prefixed with "link_". |
app_id | string | Optional | The app ID this link belongs to. |
ip | string | Optional | The user's IP address. Falls back to the request IP if not provided. |
user_agent | string | Optional | The user's browser user-agent string. Used for device fingerprinting during attribution. |
accept_language | string | Optional | The Accept-Language header from the user's browser. |
referer | string | Optional | The HTTP referer. Defaults to "direct" if not provided. |
platform | string | Optional | The detected platform (e.g. "ios", "android"). Defaults to "unknown". |
country | string | Optional | Two-letter country code derived from the request (e.g. from Cloudflare headers). |
tls_fingerprint | string | Optional | TLS JA3/JA4 fingerprint from the Cloudflare Worker, used for additional matching signals. |
Example Request
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.
{
"click_id": "m1abc123_x9f2k4p1"
}Error Response
{
"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.