API reference / Analytics
Get the retention of visitors
Who comes back. Each cohort is the visitors whose first visit fell in a week (or a month), the newest last. returned[0] is the cohort, and returned[n] is how many of them viewed a page n weeks (or months) later. A site with no cookies gives a new id to each visitor each day, so its cohorts stay empty (cookieless).
get
/api/v1/analytics/retentionOther ways to call it
CLI
troopy analytics retentionMCP tool
troopy_get_analytics_retentionRate limit60 calls in 60 seconds, for each key
Query parameters
intervalenum<string>weekmonth
Default "week"
cohortsintegerHow many weeks or months, the current one last
Default 8 · At least 2 · At most 12
Response
200 · application/jsondata*object4 properties
interval*enum<string>weekmonth
timezone*stringcookieless*booleancohorts*array<object>3 properties
start*stringISO 8601 date and time
visitors*integerreturned*array<integer>Errors
400 invalid_inputFix the field named in detail. Each operation's schema is in /api/v1/openapi.json.
401 unauthorizedSend an API key as `Authorization: Bearer tr_live_...`. Create one in Troopy under Settings.
403 forbiddenThe key lacks a scope this operation needs, or its owner lacks the role. detail says which; create a key with the scope, or ask an organization owner or admin.
429 rate_limitedWait the number of seconds in Retry-After, then retry.