Docs
Analytics
Every hosted app gets one first-party counter, and the numbers belong to the owner: no cookie, no stored IP address, and no vendor script on your visitors’ pages.
Agent tools
siteAnalyticssetSiteAutoInject
One counter per app
The key is public — tfsk_ plus 32 hex characters — and names the project and the origins allowed to report for it. The Analytics page shows the numbers, and siteAnalytics reads them for your agent; the first read for an app that has no counter yet issues its key.
Adding it
Paste one line into the app's page:
<script defer src="https://trytofu.ai/collect.js" data-site="tfsk_…"></script>Or let Tofu add it. Automatic injection is off by default and is one switch per project (the Analytics section, or setSiteAutoInject). With it on, a prebuilt static deployment gets that same line added to its root index.html at deploy time — a script from Tofu's domain in your visitors' pages, which is why the switch asks first. It never edits the files you uploaded, and switching it off and deploying again removes the line.
A deployment Tofu has to build — a framework app — never gets the line, because its source index.html is not the page that is served: add the line to the app's own template.
What is not collected
No cookie.
Nothing is written to the browser, so there is no identifier to clear and no banner to show for one.
No vendor script.
One small script from Tofu’s own domain, reporting to Tofu. Nothing about a visitor leaves Tofu’s infrastructure.
No stored IP address.
A day-salted digest only when a salt is configured; otherwise unique visitors show as —.
Do Not Track and GPC.
Both are honoured, in the browser and again on the server, before anything is derived from the visit.
Query strings and fragments are stripped before anything else reads the address, and the path is reduced: a segment that looks like an id is stored as :id.
Retention
Retention defaults to 90 days, is capped at 365 and is enforced by a daily prune; deleting a project deletes its key and its traffic. An app's counter is never sampled: the numbers you see are every view it recorded.
What analytics does not count
The collector under-counts by design.
One view per page load. A move inside a single-page app that does not load a page is not a new view.
Crawlers count like people.
Floods are braked. Views over the collector's per-minute ceilings — 600 a minute from one address to one site, and an overall ceiling above that — are dropped, so a very large spike can under-count.
No export yet. The numbers are read in the dashboard or by your agent.
说说你想做什么 app,或者带上 agent 已经做好的 app。Tofu 帮你上线。
任何 coding agent 都能用
© 2026 Tofu
trytofu.ai
本页由英文翻译;如有内容冲突,请以英文原版为准。