GET /tracking/performance/:programId

Retrieve daily performance aggregates and period-over-period trend metrics for a program

Last updated Oct 16, 2026

Returns daily aggregated metrics (clicks, leads, conversions, revenue, partners, commissions) for a program, along with period-over-period trend comparisons. This endpoint is used by the Affitor dashboard performance chart.


Endpoint

GET /api/tracking/performance/:programId


Authentication

Requests must be authenticated. The authenticated user must be an active workspace member of the requested program.

HeaderValue
AuthorizationSession token (Affitor dashboard session)

An unauthenticated request, a request from a user who is not an active workspace member of the program, and a request for a program that does not exist all return 403.

Info

This endpoint backs the Affitor dashboard. It accepts only a signed-in dashboard session for a workspace member of the program and does not accept a program API key (aff_…), so you cannot call it from a server integration with your API key.


Path Parameter

ParameterTypeRequiredDescription
programIdintegerYesID of the affiliate program

Query Parameters

ParameterTypeRequiredDescription
periodstringNoPreset time window. One of 7d, 30d, 90d, all. Defaults to 7d. Ignored when dateFrom and dateTo are provided.
dateFromstring (ISO 8601)NoStart of a custom date range. Must be used together with dateTo.
dateTostring (ISO 8601)NoEnd of a custom date range. Must be used together with dateFrom.

When dateFrom and dateTo are both present, the period parameter is ignored. The previous comparison period is automatically calculated as an equal-length window immediately before the custom range.


Response

HTTP 200 with the following shape:

{
  "data": [
    {
      "date": "2024-05-31",
      "period": "2024-05-31",
      "clicks": 42,
      "leads": 5,
      "conversions": 2,
      "revenue": 199.98,
      "partners": 1,
      "sales": 0,
      "commission": 20.00
    },
    {
      "date": "2024-06-01",
      "period": "2024-06-01",
      "clicks": 18,
      "leads": 2,
      "conversions": 0,
      "revenue": 0.00,
      "partners": 0,
      "sales": 0,
      "commission": 0.00
    }
  ],
  "metrics": {
    "totalClicks": 60,
    "totalLeads": 7,
    "totalConversions": 2,
    "totalRevenue": 199.98,
    "conversionRate": 3.33,
    "averageOrderValue": 99.99,
    "totalPartners": 1,
    "totalSales": 2,
    "totalPartnersCommission": 20.00,
    "clicksTrend": { "trend": 15.4, "trendDirection": "up", "previous": 52 },
    "leadsTrend": { "trend": 0, "trendDirection": "stable", "previous": 7 },
    "conversionsTrend": { "trend": null, "trendDirection": "up", "previous": 0 },
    "revenueTrend": { "trend": null, "trendDirection": "up", "previous": 0 },
    "partnersTrend": { "trend": 0, "trendDirection": "stable", "previous": 1 },
    "salesTrend": { "trend": null, "trendDirection": "up", "previous": 0 },
    "commissionTrend": { "trend": null, "trendDirection": "up", "previous": 0 }
  },
  "meta": {
    "period": "7d",
    "dateFrom": "2024-05-25T00:00:00.000Z",
    "dateTo": "2024-06-01T23:59:59.999Z",
    "previousPeriod": {
      "dateFrom": "2024-05-18T00:00:00.000Z",
      "dateTo": "2024-05-24T23:59:59.999Z"
    }
  }
}

data array

Each entry covers one calendar day within the requested range. Days with no activity are included with all counts set to 0.

FieldTypeDescription
datestring (YYYY-MM-DD)Calendar date for the row
periodstring (YYYY-MM-DD)Same value as date
clicksintegerReal (non-test) affiliate click events on this date
leadsintegerCustomers whose signup_date falls on this date and whose status is lead or conversion
conversionsintegerCustomers whose first_purchase_date falls on this date and whose status is conversion
revenuenumberTotal sale revenue in dollars from paid sale events on this date
partnersintegerPartner-program records created on this date
salesintegerAlways 0 (Affitor Pay checkout removed; revenue comes from sale events)
commissionnumberTotal commission amount in dollars for commissions created on this date

metrics object

Aggregated totals and trend comparisons for the full requested period.

FieldTypeDescription
totalClicksintegerTotal real click events in the period
totalLeadsintegerTotal lead-status customers in the period
totalConversionsintegerTotal conversion-status customers in the period
totalRevenuenumberTotal revenue in dollars (rounded to 2 decimal places)
conversionRatenumber(totalConversions / totalClicks) * 100, rounded to 2 decimal places. 0 if no clicks.
averageOrderValuenumbertotalRevenue / totalConversions, rounded to 2 decimal places. 0 if no conversions.
totalPartnersintegerTotal partner-program records created in the period
totalSalesintegerTotal paid sale events in the period
totalPartnersCommissionnumberTotal commission amount in dollars (rounded to 2 decimal places)
clicksTrendobjectTrend vs previous equal-length period (see below)
leadsTrendobjectTrend for leads
conversionsTrendobjectTrend for conversions
revenueTrendobjectTrend for revenue
partnersTrendobjectTrend for partners
salesTrendobjectTrend for sale count
commissionTrendobjectTrend for commission amount

Each trend object:

FieldTypeDescription
trendnumber or nullAbsolute percentage change, rounded to 1 decimal place. null when the previous period is 0 and the current one is not
trendDirectionstring"up", "down", or "stable"
previousnumberThe same metric's value in the previous period

Growth from nothing has no percentage. When the previous period value is 0 and the current value is greater than 0, trend is null and trendDirection is "up"; use previous to show it as new. When both are 0, trend is 0 and trendDirection is "stable". A change that rounds to 0.0 is "stable".

meta object

FieldTypeDescription
periodstringThe period query param value used ("7d" when none is sent)
dateFromstring (ISO 8601)Actual start of the current period used in the query
dateTostring (ISO 8601)Actual end of the current period used in the query
previousPeriod.dateFromstring (ISO 8601)Start of the comparison period
previousPeriod.dateTostring (ISO 8601)End of the comparison period

Errors

StatusWhen
403 ForbiddenNo signed-in session, the user is not an active workspace member of programId, or the program does not exist
500 Internal Server ErrorUnexpected server error