API reference / Analytics
Record visits from a server
Records pageviews and goals that a server saw, 500 at most in one call. Use it for a site without the script, for an app, or to send past visits again, up to 30 days back. Each event passes the same checks as the script: the domain, bots, exclusions and rate limits. Send the user agent and the address of the visitor. Troopy reads the place from the address and never keeps it. Without a visitor id, Troopy makes one from the address and the user agent, which changes each day. dropped says which events did not count, and why.
/api/v1/analytics/eventsOther ways to call it
troopy analytics eventsIdempotency-Key header. A retry with the same key gets the first answer back, and the operation runs one time.Body
application/jsonevents*array<object>At most 500 items
11 properties
type*enum<string>pageviewgoal
url*stringThe address of the page, on the domain of the site
At most 2000 characters · uri
namestringGoals only: the name of the goal
paramsobjectGoals only: 10 at most. Troopy keeps them as text
referrerstring | nulluserAgent*stringThe User-Agent header of the visitor
At most 500 characters
ipstring | nullThe address of the visitor, for the country and the city
visitorstringYour own id of the visitor, the same on each visit
sessionstringYour own id of the visit. Without it, the visitor id is the visit
langstringThe language of the visitor, such as en-US
At most 35 characters
atstringWhen it happened, 30 days back at most. Without it, now
Response
200 · application/jsondata*object2 properties
accepted*integerdropped*array<object>The events that did not count, by their place in events
2 properties
index*integerreason*string