Analytics
Dory sends documentation analytics to your PostHog project. There is no Dory analytics account, dashboard, admin password, or local analytics database. If PostHog is not configured, Dory does not collect analytics.
Connect PostHog#
Add your PostHog project key to dory.json:
JSON
"analytics": {
"posthog": {
"token": "phc_your_project_key",
"apiHost": "https://us.i.posthog.com"
}
}
| Field | Description |
|---|---|
posthog.token | Public PostHog project key, usually beginning with phc_. |
posthog.apiHost | Your PostHog ingestion host. Defaults to the US cloud host; set your own region or self-hosted host when needed. |
Run dory build and redeploy after changing dory.json. View the resulting events and reports in PostHog. The project key is embedded in the public site; do not put a private PostHog API key in dory.json.
If your host sets a Content Security Policy and you use a custom apiHost, allow that host's event endpoint in connect-src and its script asset origin in script-src.
What is sent#
| Source | Events |
|---|---|
| Browser | Page views and page leaves; docs_search, docs_search_result_clicked, docs_page_feedback, docs_code_copied, docs_page_engaged, and docs_chat_* interaction events. |
| Dory Node server | docs_page_request for successful documentation page requests and docs_ai_request for requests from recognized AI crawler user agents. |
Browser events work on static hosting, including a CDN. Server request events require documentation requests to reach the Dory Node server; a CDN cache hit or direct static-file response cannot be counted by that server. Browser page views and server page requests are separate event types, so use the one that matches the report you want.
Use PostHog's browser $pageview events for visitor counts. Server request events use a new anonymous ID per request to avoid sending reader identifiers, so their unique-user count does not represent unique readers.
Dory does not send chat question or answer text, conversation history, or copied code. Search terms are shortened and likely credentials are redacted before capture. Search terms can still contain personal information, so configure consent and retention in PostHog for your site. AI crawler names come from user-agent headers and are unverified.
PostHog browser tracking is disabled during local Vite development so authoring activity does not appear in production reports.
Was this page helpful?