Skip to main content
TroopyDocs
Open Troopy
Troopy

API reference / Analytics

Get a visitor

One visitor's profile: who identify said they are, the visit that found the business, and where they are now. It also gives their goals, payments, the days of the last 26 weeks with a visit, and their latest 300 events.

get/api/v1/analytics/visitors/{visitor}

Authorization

HeaderAuthorization: Bearer <API key>
Or the headerX-API-Key: <API key>
API keyMake one in Troopy under Settings > API keys. It acts as you, in its workspace.

Other ways to call it

CLItroopy analytics visitors get
MCP tooltroopy_get_analytics_visitor
Rate limit120 calls in 60 seconds, for each key

Path parameters

visitor*string

The visitor's id, as the script or SDK sent it

Response

200 · application/json
data*object
20 properties
visitor*string
name*string

The name from identify, or else a generated name, like teal otter

identified*boolean
image*string | null
userId*string | null
firstSeenAt*string

ISO 8601 date and time

lastSeenAt*string

ISO 8601 date and time

sessions*integer
pageviews*integer
revenue*number
prediction*object | null

Null until the site has 1,000 visitors and 10 payments in 90 days

2 properties
score*integer

0 to 100. 50 is a typical visitor, and 100 is a visitor who already paid

expectedValue*integer

What a visitor like this is worth on average, in minor units

traits*object
identifiedAt*string | null
first*object
7 properties
channel*string
referrer*string | null
utmSource*string | null
utmMedium*string | null
utmCampaign*string | null
host*string
path*string
last*object
6 properties
country*string | null
region*string | null
city*string | null
device*string | null
browser*string | null
os*string | null
goals*array<object>
2 properties
name*string
count*integer
payments*integer
firstPaidAt*string | null
activity*object

The days of the last 26 weeks on which the visitor viewed a page (YYYY-MM-DD), and today, in the time zone of the workspace

2 properties
today*string
days*array<string>
events*array<object>
8 properties
at*string

ISO 8601 date and time

type*string
page*string
name*string | null
props*object | null
url*string | null
amount*number | null

A payment or a refund, in minor units

currency*string | null

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.
404 not_foundCheck the path and any id in it. Every operation is listed in /api/v1/openapi.json.
429 rate_limitedWait the number of seconds in Retry-After, then retry.