API reference / Analytics
Change the analytics settings
Changes what analytics counts: the domain, other hostnames, cookieless tracking, attack mode, exclusions, the main KPI and the colour of the bars. Each list of exclusions replaces the old one. It also changes the weekly and monthly email reports, their other addresses, the alerts of spikes and drops, and the GitHub repo and branch whose commits show on the chart. share on gives the dashboard a public read-only link, and off takes the link away. reset makes a new link, and the old link no longer opens. Only owners and admins change share.
/api/v1/analytics/siteOther ways to call it
troopy analytics settingsBody
application/jsondomainstringThe root domain, like acme.com
At least 3 characters · At most 253 characters
allowedHostnamesarray<string>At most 20 items
cookielessbooleanattackModebooleanexcludeobject4 properties
pathsarray<string>Paths that analytics never counts. /admin is that page only, and /admin/* is every page under it
At most 50 items
ipsarray<string>At most 50 items
countriesarray<string>ISO 3166-1 alpha-2 codes
At most 250 items
hostnamesarray<string>At most 50 items
kpistringrevenue, mrr, or the name of a goal
colorenum<string>The colour of revenue on the charts and cards of the dashboard
redcoralpinkambergreentealblueindigovioletslate
shareenum<string>onoffreset
shareForenum<string>How long the public link opens from now: 24h, 7d, 14d, 30d, 90d, or never. It comes with share on or reset
24h7d14d30d90dnever
sharePasswordstring | nullA password that the public link asks for, 6 characters at least. null takes it away. A frame in another page cannot open a link with a password
shareSegmentstring | nullThe id of a saved segment that the public link always shows. null: all visitors
weeklyReportbooleanmonthlyReportbooleanreportEmailsarray<string>More addresses for the reports and the traffic alerts, 10 at most. Each list replaces the old one. Only owners and admins change it
At most 10 items
spikeAlertsbooleandropAlertsbooleangithubRepostring | nullowner/name: one of the repos that the GitHub connection of the workspace reaches. With null, the chart shows no commits
githubBranchstring | nullThe branch of the repo whose commits show on the chart, like production. Null, or no branch with a new repo: the default branch. A new repo or branch takes the commits of the old one off the chart
mentionsobjectWhat to look for on X and Reddit besides the domain
2 properties
keywords*array<string>4 to 15 characters each, any case
At most 10 items
handles*array<string>X handles whose posts and bio links count, like @acme
At most 5 items
proxystring | nullA subdomain of the site for the managed proxy, like a.acme.com. Point its CNAME at proxy.troopy.ai. null takes the proxy away
Response
200 · application/jsondata*object23 properties
siteId*stringThe public id that the tracking script sends
domain*stringThe root domain: every subdomain counts too
allowedHostnames*array<string>Other domains that count as this site
cookieless*booleanattackMode*booleanStricter bot filters, for a site under attack
replays*booleanSession replays and heatmaps of a share of the visits (PATCH /session-settings). The tag carries data-replay with the share
replaySample*numberThe share of visits that replays record, 0.01 to 1
exclude*object4 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*stringWhat 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*stringThe tag to paste into the <head> of every page
timezone*stringThe days of reports start at midnight in this time zone
share*object | nullThe read-only dashboard that anyone with the link can open
4 properties
url*stringAdd ?embed=true to show it in a frame of another page
until*string | nullWhen the link stops opening, or null when it never stops
password*booleanWhether the link asks for a password
segment*string | nullThe saved segment that the link always shows, or null for all visitors
hasEvents*booleanWhether the script sent anything yet
weeklyReport*booleanA weekly summary by email to the owners and admins of the organization, on Monday morning
monthlyReport*booleanA 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*booleanAn email to owners and admins when visits jump well above the usual
dropAlerts*booleanAn email to owners and admins when the pageviews of the last 12 hours fall far under the usual
githubRepo*string | nullThe repo whose commits show as notes on the chart (owner/name)
githubBranch*string | nullThe branch of that repo whose commits show. Null: the default branch
mentions*objectWords 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 | nullThe managed proxy: the script and events on a subdomain of the site, so ad blockers leave them alone
5 properties
host*stringThe 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 | nullWhat the last check found missing
checkedAt*string | nulltarget*stringWhere the CNAME of the host points, like proxy.troopy.ai