Use this endpoint to track when a visitor clicks an affiliate link. This is useful for server-side tracking implementations. The click can later be converted to a referral using the clickId parameter in the Create Referral endpoint.
Body Parameters
The unique identifier of the affiliate program. The program must belong to your team.
The affiliate’s tracking ID. The affiliate must have an approved partnership with the specified program.
Sub-parameter 1 for custom tracking. Maximum 255 characters.
Sub-parameter 2 for custom tracking. Maximum 255 characters.
Sub-parameter 3 for custom tracking. Maximum 255 characters.
Sub-parameter 4 for custom tracking. Maximum 255 characters.
Sub-parameter 5 for custom tracking. Maximum 255 characters.
The referring URL where the click originated. Maximum 2000 characters.
Visitor’s IP address. Maximum 45 characters (supports IPv6).
Visitor’s user agent string. Maximum 1000 characters.
UTM source parameter. Maximum 255 characters.
UTM medium parameter. Maximum 255 characters.
UTM campaign parameter. Maximum 255 characters.
UTM term parameter. Maximum 255 characters.
UTM content parameter. Maximum 255 characters.
Google Click ID for Google Ads tracking. Maximum 255 characters.
Facebook Click ID for Facebook Ads tracking. Maximum 255 characters.
Microsoft Click ID for Microsoft Ads tracking. Maximum 255 characters.
TikTok Click ID for TikTok Ads tracking. Maximum 255 characters.
Response
The response includes the created click object.
Always true for successful responses
The created click object. Show Data Object Properties
Unique identifier for the click. This ID can be used in the Create Referral endpoint’s clickId parameter to convert the click to a referral.
The affiliate’s tracking ID
ISO 8601 timestamp of when the click was recorded
curl -X POST "https://api.affonso.io/v1/clicks" \
-H "Authorization: Bearer sk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"programId": "prg_456def",
"trackingId": "PARTNER123",
"referrer": "https://partner-blog.com/review",
"utmSource": "partner-blog",
"utmMedium": "referral",
"utmCampaign": "summer-2024"
}'
{
"success" : true ,
"data" : {
"id" : "clk_xyz789" ,
"trackingId" : "PARTNER123" ,
"programId" : "prg_456def" ,
"createdAt" : "2024-01-25T12:00:00Z"
}
}
Note: To convert a click to a referral, use the click’s id as the clickId parameter when creating a referral via POST /v1/referrals.