mirror of
https://github.com/mintlify/docs.git
synced 2026-09-14 13:35:46 +08:00
f544840964
Co-authored-by: locadex-agent[bot] <217277504+locadex-agent[bot]@users.noreply.github.com>
65 lines
1.9 KiB
Plaintext
65 lines
1.9 KiB
Plaintext
---
|
||
title: "PostHog"
|
||
description: "使用 PostHog 跟踪产品分析与功能使用情况。"
|
||
keywords: ["PostHog 集成", "产品分析", "功能开关", "自托管 PostHog"]
|
||
---
|
||
|
||
在你的 `docs.json` 文件中添加以下配置,将 Analytics 数据发送到 PostHog。
|
||
|
||
只有在自托管 PostHog 时才需要包含 `apiHost`。默认情况下,我们会将事件发送到 `https://app.posthog.com`。
|
||
|
||
<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://app.posthog.com`。
|
||
</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 的项目设置中。
|