Files
lobehub/docs/self-hosting/environment-variables/analytics.mdx
sxjeru 2a811d0a85 🔨 chore: Prettier & Add proxyUrl for all providers (#8061)
* migration: 添加移除 reasoning_effort 参数和删除 doubao 的迁移脚本

* Refactor code structure for improved readability and maintainability

* npx prettier --write "src/**/*"

* add proxyUrl for all providers

* npx prettier --write "docs/**/*"

* Revert

* Revert

* revert
2025-06-04 21:39:39 +08:00

113 lines
3.2 KiB
Plaintext
Raw 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: Integrating Analytics in LobeChat
description: >-
Learn how to configure environment variables for Vercel Analytics, Google Analytics, PostHog Analytics, and Umami Analytics in LobeChat for data collection and analysis.
tags:
- Data Analytics
- LobeChat
- Analytics Services
- Environment Variables
- Configuration
---
# Data Analytics
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
### `GOOGLE_ANALYTICS_MEASUREMENT_ID`
- Type: Required
- Description: Google Analytics Measurement IDyou can get it from the Google Analytics dashboard. Add it will auto enable Google Analytics.
- Default: `-`
- Example: `G-63LP2TV03T`
## Posthog Analytics
### `POSTHOG_KEY`
- Type: Required
- Description: Set the PostHog project Key. Add it will auto enable PostHog Analytics.
- Default: `-`
- Example: `phc_xxxxxxxx`
### `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`
### `DEBUG_POSTHOG_ANALYTICS`
- Type: Optional
- Description: Enable the debug mode for PostHog.
- Default: `-`
- Example: `1`
## Umami Analytics
### `UMAMI_WEBSITE_ID`
- Type: Required
- Description: Your Umami Website ID. Add it will auto enable Umami Analytics.
- Default: `-`
- Example: `E738D82A-EE9E-4806-A81F-0CA3CAE57F65`
### `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`
## Langfuse Observability
[Langfuse](https://langfuse.com/) is an [open-source](https://github.com/langfuse/langfuse) LLM Observability platform. By enabling the Langfuse integration, you can trace your chat data with Langfuse to develop, monitor, and evaluate the use of your LobeChat.
### `ENABLE_LANGFUSE`
- Type: Required
- Description: Determines if Langfuse analytics is enabled.
- Default: `1`
- Example: `1`
### `LANGFUSE_SECRET_KEY`
- Type: Required
- Description: Langfuse API secret key. Can be created by signing up for [Langfuse Cloud](https://cloud.langfuse.com) or by self-hosting Langfuse.
- Default: \`\`
- Example: `sk-lf-...`
### `LANGFUSE_PUBLIC_KEY`
- Type: Required
- Description: Langfuse API public key. Can be created by signing up for [Langfuse Cloud](https://cloud.langfuse.com) or by self-hosting Langfuse.
- Default: \`\`
- Example: `pk-lf-...`
### `LANGFUSE_HOST`
- Type: Required
- Description: Langfuse host address. Use `https://us.cloud.langfuse.com` if your Langfuse project is in the US data region.
- Default: `https://cloud.langfuse.com`
- Example: `https://cloud.langfuse.com`