forked from lobehub/lobe-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ refactor: refactor the Vercel Aanlytics and support Google Aanlyti…
…cs (lobehub#1688) * ♻️ refactor: migrating to the latest Speed Insights package * ✨ feat: support google analytics * 📝 docs: update docs * 📝 docs: update docs
- Loading branch information
Showing
15 changed files
with
282 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Data Statistics | ||
|
||
We have integrated several free/open-source data analytics services in LobeChat for collecting user usage data. Here are environment variables that you can use. | ||
|
||
## Vercel Analytics | ||
|
||
### `ENABLE_VERCEL_ANALYTICS` | ||
|
||
- Type: Optional | ||
- Description: Used to configure the environment variable for Vercel Analytics. Set to `1` to enable Vercel Analytics. | ||
- Default: `-` | ||
- Example: `1` | ||
|
||
### `DEBUG_VERCEL_ANALYTICS` | ||
|
||
- Type: Optional | ||
- Description: Used to enable the debug mode for Vercel Analytics. | ||
- Default: `-` | ||
- Example: `1` | ||
|
||
## Google Analytics | ||
|
||
### `ENABLE_GOOGLE_ANALYTICS` | ||
|
||
- Type: Optional | ||
- Description: Used to configure the environment variable for Google Analytics. Set to `1` to enable Google Analytics. | ||
- Default: `-` | ||
- Example: `1` | ||
|
||
### `GOOGLE_ANALYTICS_MEASUREMENT_ID` | ||
|
||
- Type: Required | ||
- Description: Google Analytics Measurement ID,you can get it from the Google Analytics dashboard. | ||
- Default: `-` | ||
- Example: `G-63LP2TV03T` | ||
|
||
## Posthog Analytics | ||
|
||
### `NEXT_PUBLIC_ANALYTICS_POSTHOG` | ||
|
||
- Type: Optional | ||
- Description: Used to enable the environment variable for [PostHog Analytics][posthog-analytics-url]. Set to `1` to enable PostHog Analytics. | ||
- Default: `-` | ||
- Example: `1` | ||
|
||
### `NEXT_PUBLIC_POSTHOG_KEY` | ||
|
||
- Type: Optional | ||
- Description: Set the PostHog project Key. | ||
- Default: `-` | ||
- Example: `phc_xxxxxxxx` | ||
|
||
### `NEXT_PUBLIC_POSTHOG_HOST` | ||
|
||
- Type: Optional | ||
- Description: Set the deployment address of the PostHog service, defaulting to the official SAAS address. | ||
- Default: `https://app.posthog.com` | ||
- Example: `https://example.com` | ||
|
||
### `NEXT_PUBLIC_POSTHOG_DEBUG` | ||
|
||
- Type: Optional | ||
- Description: Enable the debug mode for PostHog. | ||
- Default: `-` | ||
- Example: `1` | ||
|
||
## Umami Analytics | ||
|
||
### `NEXT_PUBLIC_ANALYTICS_UMAMI` | ||
|
||
- Type: Optional | ||
- Description: Used to enable the environment variable for [Umami Analytics][umami-analytics-url]. Set to `1` to enable Umami Analytics. | ||
- Default: `-` | ||
- Example: `1` | ||
|
||
### `NEXT_PUBLIC_UMAMI_SCRIPT_URL` | ||
|
||
- Type: Optional | ||
- Description: The URL of the Umami script, defaulting to the script URL provided by Umami Cloud. | ||
- Default: `https://analytics.umami.is/script.js` | ||
- Example: `https://umami.your-site.com/script.js` | ||
|
||
### `NEXT_PUBLIC_UMAMI_WEBSITE_ID` | ||
|
||
- Type: Required | ||
- Description: Your Umami Website ID. | ||
- Default: `-` | ||
- Example: `E738D82A-EE9E-4806-A81F-0CA3CAE57F65` | ||
|
||
[posthog-analytics-url]: https://posthog.com | ||
[umami-analytics-url]: https://umami.is |
91 changes: 91 additions & 0 deletions
91
docs/self-hosting/environment-variables/analytics.zh-CN.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# 数据统计 | ||
|
||
我们在 LobeChat 中集成了若干免费 / 开源的数据统计服务,用于了解用户的使用情况,以下是相关环境变量。 | ||
|
||
## Vercel Analytics | ||
|
||
### `ENABLE_VERCEL_ANALYTICS` | ||
|
||
- 类型:可选 | ||
- 描述:用于配置 Vercel Analytics 的环境变量,当设为 `1` 时开启 Vercel Analytics | ||
- 默认值: `-` | ||
- 示例:`1` | ||
|
||
### `DEBUG_VERCEL_ANALYTICS` | ||
|
||
- 类型:可选 | ||
- 描述:用于开启 Vercel Analytics 的调试模式 | ||
- 默认值: `-` | ||
- 示例:`1` | ||
|
||
## Google Analytics | ||
|
||
### `ENABLE_GOOGLE_ANALYTICS` | ||
|
||
- 类型:必选 | ||
- 描述:用于配置 Google Analytics 的环境变量,当设为 `1` 时开启 Google Analytics | ||
- 默认值: `-` | ||
- 示例:`1` | ||
|
||
### `GOOGLE_ANALYTICS_MEASUREMENT_ID` | ||
|
||
- 类型:必选 | ||
- 描述:Google Analytics 的 Measurement ID,如果开启了 Google Analytics,此项必填 | ||
- 默认值: `-` | ||
- 示例:`G-63LP2TV03T` | ||
|
||
## Posthog Analytics | ||
|
||
### `NEXT_PUBLIC_ANALYTICS_POSTHOG` | ||
|
||
- 类型:可选 | ||
- 描述:用于开启 [PostHog Analytics][posthog-analytics-url] 的环境变量,设为 `1` 时开启 PostHog Analytics | ||
- 默认值: `-` | ||
- 示例:`1` | ||
|
||
### `NEXT_PUBLIC_POSTHOG_KEY` | ||
|
||
- 类型:可选 | ||
- 描述:设置 PostHog 项目 Key | ||
- 默认值: `-` | ||
- 示例:`phc_xxxxxxxx` | ||
|
||
### `NEXT_PUBLIC_POSTHOG_HOST` | ||
|
||
- 类型:可选 | ||
- 描述:设置 PostHog 服务的部署地址,默认为官方的 SAAS 地址 | ||
- 默认值:`https://app.posthog.com` | ||
- 示例:`https://example.com` | ||
|
||
### `NEXT_PUBLIC_POSTHOG_DEBUG` | ||
|
||
- 类型:可选 | ||
- 描述:开启 PostHog 的调试模式 | ||
- 默认值: `-` | ||
- 示例:`1` | ||
|
||
## Umami Analytics | ||
|
||
### `NEXT_PUBLIC_ANALYTICS_UMAMI` | ||
|
||
- 类型:可选 | ||
- 描述:用于开启 [Umami Analytics][umami-analytics-url] 的环境变量,设为 `1` 时开启 Umami Analytics | ||
- 默认值: `-` | ||
- 示例:`1` | ||
|
||
### `NEXT_PUBLIC_UMAMI_SCRIPT_URL` | ||
|
||
- 类型:可选 | ||
- 描述:Umami 脚本的网址,默认为 Umami Cloud 提供的脚本网址 | ||
- 默认值:`https://analytics.umami.is/script.js` | ||
- 示例:`https://umami.your-site.com/script.js` | ||
|
||
### `NEXT_PUBLIC_UMAMI_WEBSITE_ID` | ||
|
||
- 类型:必选 | ||
- 描述:你的 Umami 的 Website ID | ||
- 默认值:`-` | ||
- 示例:`E738D82A-EE9E-4806-A81F-0CA3CAE57F65` | ||
|
||
[posthog-analytics-url]: https://posthog.com | ||
[umami-analytics-url]: https://umami.is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.