mirror of
https://github.com/mintlify/docs.git
synced 2026-09-14 13:35:46 +08:00
bbb1a08ed3
Co-authored-by: locadex-agent[bot] <217277504+locadex-agent[bot]@users.noreply.github.com>
56 lines
1.9 KiB
Plaintext
56 lines
1.9 KiB
Plaintext
---
|
||
title: "Google Analytics 4"
|
||
description: "使用 Google Analytics 跟踪访客行为与参与度。"
|
||
keywords: ["GA4 integration", "measurement ID", "web stream", "Universal Analytics"]
|
||
---
|
||
|
||
你需要创建一个新的<Tooltip tip="Google Analytics 4">GA4</Tooltip>资源以供 Mintlify 使用。收集的数据将归入与你其他 Google Analytics 数据相同的项目。
|
||
|
||
如果你仍在使用旧版 Google Analytics(Universal Analytics),依然可以创建<Tooltip tip="Google Analytics 4">GA4</Tooltip>资源。<Tooltip tip="Google Analytics 4">GA4</Tooltip>数据与 UA 数据略有差异,但都会汇集到同一个项目中。
|
||
|
||
<div id="how-to-connect-ga4-to-mintlify">
|
||
## 如何将 GA4 接入 Mintlify
|
||
</div>
|
||
|
||
<div id="create-a-web-stream">
|
||
### 创建 Web 流
|
||
</div>
|
||
|
||
你需要创建一个 Web 流以获取 Measurement ID,并将其填入 Mintlify。
|
||
|
||
点击 Google Analytics 界面左下角的齿轮图标,然后点击 Data Streams。
|
||
|
||
<Frame></Frame>
|
||
|
||
创建一个 Web 流,并将你的 Mintlify 文档站点的 URL 作为流的 URL。
|
||
|
||
你的 Measurement ID 类似于 `G-XXXXXXX`,创建 Web 流后会立即显示在 Stream Details 下方。
|
||
|
||
<div id="put-measurement-id-in-docsjson">
|
||
### 在 docs.json 中添加 Measurement ID
|
||
</div>
|
||
|
||
将你的 Measurement ID 添加到 `docs.json` 文件中,如下所示:
|
||
|
||
```json docs.json
|
||
"integrations": {
|
||
"ga4": {
|
||
"measurementId": "G-XXXXXXX"
|
||
}
|
||
}
|
||
```
|
||
|
||
|
||
<div id="wait">
|
||
### 请稍候
|
||
</div>
|
||
|
||
Google Analytics 通常需要两到三天才会显示你的数据。
|
||
|
||
你可以使用 [Google Analytics Debugger](https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna?hl=en) 检查是否已正确启用 Analytics。每当 GA4 发出请求时,该扩展都会在你的浏览器控制台中记录日志。
|
||
|
||
<Note>
|
||
|
||
预览链接的 Analytics 已禁用。
|
||
|
||
</Note> |