Skip to main content
TroopyDocs
Open Troopy
Troopy

API reference / Analytics

Get the analytics site

The workspace's website as analytics sees it: the script tag to install, the domain, what analytics excludes and the main KPI. It also gives the time zone of reports, and whether any visit arrived yet. The first call sets the site up from the workspace's website.

get/api/v1/analytics/site

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 site
MCP tooltroopy_get_analytics_site
Rate limit120 calls in 60 seconds, for each key

Response

200 · application/json
data*object
23 properties
siteId*string

The public id that the tracking script sends

domain*string

The root domain: every subdomain counts too

allowedHostnames*array<string>

Other domains that count as this site

cookieless*boolean
attackMode*boolean

Stricter bot filters, for a site under attack

replays*boolean

Session replays and heatmaps of a share of the visits (PATCH /session-settings). The tag carries data-replay with the share

replaySample*number

The share of visits that replays record, 0.01 to 1

exclude*object
4 properties
paths*array<string>

Paths that analytics never counts. /admin is that page only, and /admin/* is every page under it

At most 50 items

ips*array<string>

At most 50 items

countries*array<string>

ISO 3166-1 alpha-2 codes

At most 250 items

hostnames*array<string>

At most 50 items

kpi*string

What the dashboard leads with: revenue, mrr, or the name of a goal

color*enum<string>

The colour of revenue on the charts and cards of the dashboard

redcoralpinkambergreentealblueindigovioletslate

script*string

The tag to paste into the <head> of every page

timezone*string

The days of reports start at midnight in this time zone

share*object | null

The read-only dashboard that anyone with the link can open

4 properties
url*string

Add ?embed=true to show it in a frame of another page

until*string | null

When the link stops opening, or null when it never stops

password*boolean

Whether the link asks for a password

segment*string | null

The saved segment that the link always shows, or null for all visitors

hasEvents*boolean

Whether the script sent anything yet

weeklyReport*boolean

A weekly summary by email to the owners and admins of the organization, on Monday morning

monthlyReport*boolean

A monthly summary by email, on the morning of the first day of the month

reportEmails*array<string>

More addresses that get the reports and the traffic alerts, besides the owners and admins

spikeAlerts*boolean

An email to owners and admins when visits jump well above the usual

dropAlerts*boolean

An email to owners and admins when the pageviews of the last 12 hours fall far under the usual

githubRepo*string | null

The repo whose commits show as notes on the chart (owner/name)

githubBranch*string | null

The branch of that repo whose commits show. Null: the default branch

mentions*object

Words and X handles that Troopy finds on X and Reddit, as well as the domain. Posts that name them show as notes on the chart

2 properties
keywords*array<string>
handles*array<string>
proxy*object | null

The managed proxy: the script and events on a subdomain of the site, so ad blockers leave them alone

5 properties
host*string

The subdomain of the site that serves the script, like a.acme.com

status*enum<string>

pending until a check finds the CNAME and the script over HTTPS

pendingactivefailed

error*string | null

What the last check found missing

checkedAt*string | null
target*string

Where the CNAME of the host points, like proxy.troopy.ai

Errors

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.