---
title: 分析与会话回放提供商
description: 通过 docs.json 配置 PostHog、Mixpanel、Amplitude、Hotjar、Microsoft Clarity、Fathom、Pirsch、Heap、LogRocket、Segment、Clearbit、Hightouch 或 Koala。
---

> **For AI agents:** the complete documentation index is at [llms.txt](/docs/llms.txt). Append `.md` to any page URL for its markdown version.

Jamdesk 会直接从 `docs.json` 为 13 个额外的分析、会话回放和身份识别提供商加载脚本。在 `integrations` 下添加提供商配置块，Jamdesk 就会在已发布文档站点的每个页面注入其脚本。

<Info>
Jamdesk 加载脚本前，会根据严格格式检查每个值。格式错误的值（包含多余字符、前缀错误或长度错误）会被静默跳过，既不会显示错误页面，也不会生成损坏的脚本标签。如果某个提供商未加载，请从其仪表板重新复制值，并根据下方格式进行检查。
</Info>

## 从仪表板配置

配置这些提供商最快的方法是：**Dashboard → Integrations**。选择提供商卡片，粘贴其密钥，Jamdesk 会为你提交 `docs.json` 配置块并触发重新构建（仅限已连接 GitHub 的项目）。以下部分适用于直接编辑 `docs.json`，或仅使用 CLI 的项目。

## PostHog

产品分析、会话回放和功能标志。

**格式：**项目 API 密钥以 `phc_` 开头，后跟 8–64 个字母或数字。可选的 API 主机必须是 `https://` URL。

<Info>
在 PostHog 中，前往 **Settings → Project → Project API key** 查找密钥。
</Info>

```json docs.json
{
  "integrations": {
    "posthog": {
      "apiKey": "phc_Kj8fPqZx92RmNbTeYcWs",
      "apiHost": "https://us.i.posthog.com"
    }
  }
}
```

`apiHost` 为可选项，默认为 `https://us.i.posthog.com`。如果使用欧盟云主机或反向代理 URL，请将其设置为对应地址。

## Mixpanel

事件分析和漏斗分析。

**格式：**项目令牌必须正好包含 32 个小写十六进制字符（`0-9`、`a-f`）。

<Info>
在 Mixpanel 中，前往 **Project Settings → Access Keys → Project Token** 查找令牌。
</Info>

```json docs.json
{
  "integrations": {
    "mixpanel": {
      "projectToken": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6"
    }
  }
}
```

## Amplitude

产品分析和行为群体分析。

**格式：**API 密钥必须正好包含 32 个小写十六进制字符（`0-9`、`a-f`）。

<Info>
在 Amplitude 中，前往 **Settings → Projects → your project → API Key** 查找密钥。
</Info>

```json docs.json
{
  "integrations": {
    "amplitude": {
      "apiKey": "f6e5d4c3b2a1908877665544332211ff"
    }
  }
}
```

## Hotjar

热图和会话录制。

**格式：**站点 ID 为 1–12 位数字。代码段版本为 1–4 位数字（通常为 `6`）。

<Info>
在 Hotjar 中，前往 **Sites & Organizations → your site** 查找这两个值。
</Info>

```json docs.json
{
  "integrations": {
    "hotjar": {
      "hjid": "3482910",
      "hjsv": "6"
    }
  }
}
```

<Warning>
Hotjar 会记录访客会话。如果 GDPR、CCPA 或类似法规适用于你的读者，请将其置于 [Cookie Consent](/cn/integrations/cookie-consent) 之后。
</Warning>

## Microsoft Clarity

免费的热图和会话录制。

**格式：**项目 ID 为 4–32 个字母或数字。

<Info>
在 Clarity 中，前往 **Settings → Overview → Project ID** 查找项目 ID。
</Info>

```json docs.json
{
  "integrations": {
    "clarity": {
      "projectId": "qbxk2paw9m"
    }
  }
}
```

<Warning>
Clarity 会记录访客会话。如果 GDPR、CCPA 或类似法规适用于你的读者，请将其置于 [Cookie Consent](/cn/integrations/cookie-consent) 之后。
</Warning>

## Fathom

注重隐私、无需 Cookie 的分析。

**格式：**站点 ID 为 4–16 个字母或数字。

<Info>
在 Fathom 中，前往 **Settings → Sites → your site** 查找站点 ID。
</Info>

```json docs.json
{
  "integrations": {
    "fathom": {
      "siteId": "ABCD1234"
    }
  }
}
```

## Pirsch

无需 Cookie、注重隐私的分析。

**格式：**识别代码为 4–64 个字母或数字。

<Info>
在 Pirsch 中，前往 **Settings → Developer → Identification Code** 查找代码。
</Info>

```json docs.json
{
  "integrations": {
    "pirsch": {
      "id": "Jd8fK2pQmZx9AeRt"
    }
  }
}
```

## Heap

自动捕获事件，无需手动插桩。

**格式：**应用 ID 为 6–20 位数字。

<Info>
在 Heap 中，前往 **Account → Manage → Projects** 查找 App ID。
</Info>

```json docs.json
{
  "integrations": {
    "heap": {
      "appId": "1234567890"
    }
  }
}
```

## LogRocket

支持控制台和网络日志的会话回放。

**格式：**应用 ID 由两个以斜杠分隔的 slug 段组成，即 `org-slug/app-slug`；每段包含 2–64 个小写字母、数字或连字符。

<Info>
在 LogRocket 中，前往 **Settings → Project Setup** 查找 App ID。
</Info>

```json docs.json
{
  "integrations": {
    "logrocket": {
      "appId": "acme-inc/docs-site"
    }
  }
}
```

<Warning>
LogRocket 会记录访客会话，包括控制台和网络活动。如果 GDPR、CCPA 或类似法规适用于你的读者，请将其置于 [Cookie Consent](/cn/integrations/cookie-consent) 之后。
</Warning>

## Segment

从一个来源将文档事件路由到每个下游工具。

**格式：**写入密钥为 10–64 个字母或数字（不含连字符或下划线）。

<Info>
在 Segment 中，前往 **Connections → Sources → your JS source → Settings → API Keys** 查找写入密钥。
</Info>

```json docs.json
{
  "integrations": {
    "segment": {
      "key": "hcQ8wK9pXeR2mNq7"
    }
  }
}
```

## Clearbit

识别并丰富匿名访客信息。

**格式：**公共 API 密钥以 `pk_` 开头，后跟 6–64 个字母或数字。

```json docs.json
{
  "integrations": {
    "clearbit": {
      "publicApiKey": "pk_4f8a2e1c9b6d"
    }
  }
}
```

## Hightouch

将文档事件直接发送到数据仓库。

**格式：**写入密钥为 8–128 个字符（包括字母、数字、`:`、`.`、`_`、`-`）。可选的 API 主机为 4–64 个字符（包括字母、数字、`.`、`-`）。

```json docs.json
{
  "integrations": {
    "hightouch": {
      "writeKey": "wk_prod_4f8a2e1c9b6d",
      "apiHost": "us-east-1.hightouch-events.com"
    }
  }
}
```

`apiHost` 为可选项，仅在使用自托管或特定区域的 Hightouch 事件端点时需要设置。

## Koala

识别高意向访客，用于销售和营销。

**格式：**公共 API 密钥以 `pk_` 开头，后跟 6–64 个字母或数字。

```json docs.json
{
  "integrations": {
    "koala": {
      "publicApiKey": "pk_7e3a9c1f6b2d"
    }
  }
}
```

## 同意控制

上述全部 13 个提供商都遵循 `integrations.cookies` 的设置。启用该设置后，只有在同意横幅记录批准后，它们的脚本才会加载。如需完整配置，请参阅 [Cookie Consent](/cn/integrations/cookie-consent)。未启用时，每个脚本都会在页面加载时为每位访客加载。

## 相关文章

<Columns cols={3}>
  <Card title="Cookie Consent" icon="cookie-bite" href="/cn/integrations/cookie-consent">
    在访客同意后再加载这些脚本
  </Card>
  <Card title="Google Analytics" icon="chart-simple" href="/cn/integrations/google-analytics">
    使用测量 ID 添加 GA4
  </Card>
  <Card title="Support & Chat Providers" icon="comments" href="/cn/integrations/support-chat">
    Intercom 和 Front Chat 实时聊天组件
  </Card>
</Columns>