Tracking API
Use the Tracking API to record affiliate clicks, registrations, and payments from your server. This is the server-side complement to the JavaScript tracking snippet.
Track a click
Record an affiliate link click. Normally the JavaScript snippet handles this automatically — use this endpoint only if you need server-side click tracking.
{
"clientId": 12345,
"affiliateReference": "aff_xyz123",
"clickId": "click_unique_id",
"sessionId": "session_unique_id",
"clickedUrl": "https://yourwebsite.com/pricing",
"referrerUrl": "https://blog.example.com/review",
"userAgent": "Mozilla/5.0 ...",
"source": "blog"
}{
"success": true,
"clickId": 789,
"sessionId": "session_unique_id",
"message": "Click tracked successfully"
}Track a registration (lead)
Call this endpoint when a referred user registers on your platform. Links the registration to an affiliate click via the session ID stored in their browser cookie.
{
"clickId": "click_unique_id",
"email": "customer@example.com",
"customerId": "your_internal_user_id",
"customerName": "Jane Smith"
}{
"success": true,
"leadId": 456,
"clickId": "click_unique_id",
"message": "Registration linked to affiliate referral"
}clickId is stored in a cookie by the JavaScript tracking snippet (affy_click_id). Read it from the browser and pass it to your server when the user registers.Track a lead (registration event)
Alternative endpoint for tracking registration leads with more detail. Use when you want to pass a session ID instead of a click ID.
{
"clientId": 12345,
"leadType": "REGISTRATION",
"customerEmail": "customer@example.com",
"customerName": "Jane Smith",
"sessionId": "session_unique_id"
}Track a payment lead
Track when a referred customer makes a payment outside of a connected gateway.
{
"clientId": 12345,
"leadType": "PAYMENT",
"customerEmail": "customer@example.com",
"leadValue": 99.00,
"sessionId": "session_unique_id"
}{
"success": true,
"leadId": 456,
"leadValue": 99.00,
"conversionSource": "TRACKING_API",
"message": "Payment linked to affiliate referral"
}Get tracking status
Check whether a session is associated with an affiliate click. Useful for debugging or verifying tracking is working.
curl https://api.affy.pro/api/v1/tracking/status/session_unique_id{
"sessionId": "session_unique_id",
"hasAffiliate": true,
"affiliateReference": "aff_xyz123",
"clickId": 789,
"clickedAt": "2026-03-01T14:30:00Z"
}Common integration pattern
Here's a typical server-side integration flow when a user registers:
// 1. Read the affiliate click ID from the request cookie
const clickId = req.cookies.affy_click_id
// 2. Register the user in your system
const user = await createUser({ email, password })
// 3. Report the registration to AFFY (fire and forget)
if (clickId) {
await fetch('https://api.affy.pro/api/v1/tracking/registration', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
clickId,
email: user.email,
customerId: user.id,
customerName: user.name
})
}).catch(err => console.error('AFFY tracking failed:', err))
}