Files
mintlify__docs/zh/integrations/analytics/posthog.mdx
mintlify[bot] 5a3d1ddabb docs: sync es/fr/zh translations with recent English updates (#6140)
* docs: sync es/fr/zh translations with recent English updates

* docs: tighten descriptions and replace HTML entities with real quotes

---------

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
2026-06-10 11:49:25 -07:00

66 lines
2.0 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "PostHog"
description: "将 PostHog 集成到你的 Mintlify 文档站点,使用 API 密钥跟踪产品分析、功能使用情况和用户行为。"
keywords: ["PostHog 集成", "产品分析", "功能开关", "自托管 PostHog"]
boost: 3
---
在你的 `docs.json` 文件中添加以下配置,将 Analytics 数据发送到 PostHog。
只有在自托管 PostHog 时才需要包含 `apiHost`。默认情况下,Mintlify 会通过 `https://ph.mintlify.com` 代理将事件转发到你的 PostHog 项目。
<CodeGroup>
```json docs.json 中的 Analytics 选项
"integrations": {
"posthog": {
"apiKey": "YOUR_POSTHOG_PROJECT_API_KEY",
"apiHost": "optional",
"sessionRecording": true
}
}
```
```json 示例
"integrations": {
"posthog": {
"apiKey": "phc_TXdpocbYTeZVm5VJmMzHTMrCofBQu3e0kN7HGMNGTVW"
}
}
```
</CodeGroup>
<div id="configuration-options">
### 配置选项
</div>
<ParamField path="apiKey" type="string" required>
你的 PostHog 项目 API key。必须以 `phc_` 开头。
</ParamField>
<ParamField path="apiHost" type="string">
你的 PostHog 实例的 URL。仅在自托管 PostHog 时必填。默认为 `https://ph.mintlify.com`(Mintlify 的 PostHog 代理)。
</ParamField>
<ParamField path="sessionRecording" type="boolean" default="true">
启用或禁用会话录制。将其设为 `false` 可在保持 Analytics 启用的同时禁用会话录制。
</ParamField>
<div id="session-recordings">
## 会话录制
</div>
在配置 PostHog 时,会话录制默认开启。若要在保持 Analytics 启用的情况下禁用会话录制,请在配置中将 `sessionRecording` 设置为 `false`。
```json Disable session recordings
"integrations": {
"posthog": {
"apiKey": "phc_your-key",
"sessionRecording": false
}
}
```
在接收会话录制之前,你需要将文档网站的 URL 添加到 PostHog 的“录制授权域名”(Authorized domains for recordings)。添加 URL 的选项位于 PostHog 的项目设置中。