---
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 ID，you 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`

[posthog-analytics-url]: https://posthog.com
[umami-analytics-url]: https://umami.is
