diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py
index 00fc1b36f3..9c458cba17 100644
--- a/backend/open_webui/config.py
+++ b/backend/open_webui/config.py
@@ -1678,6 +1678,10 @@ ENABLE_ADMIN_CHAT_ACCESS = (
os.environ.get("ENABLE_ADMIN_CHAT_ACCESS", "True").lower() == "true"
)
+ENABLE_ADMIN_ANALYTICS = (
+ os.environ.get("ENABLE_ADMIN_ANALYTICS", "True").lower() == "true"
+)
+
ENABLE_COMMUNITY_SHARING = PersistentConfig(
"ENABLE_COMMUNITY_SHARING",
"ui.enable_community_sharing",
diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py
index b95166a9fd..a99ea4b015 100644
--- a/backend/open_webui/main.py
+++ b/backend/open_webui/main.py
@@ -434,6 +434,7 @@ from open_webui.config import (
RESPONSE_WATERMARK,
# Admin
ENABLE_ADMIN_CHAT_ACCESS,
+ ENABLE_ADMIN_ANALYTICS,
BYPASS_ADMIN_ACCESS_CONTROL,
ENABLE_ADMIN_EXPORT,
# Tasks
@@ -1530,7 +1531,8 @@ app.include_router(functions.router, prefix="/api/v1/functions", tags=["function
app.include_router(
evaluations.router, prefix="/api/v1/evaluations", tags=["evaluations"]
)
-app.include_router(analytics.router, prefix="/api/v1/analytics", tags=["analytics"])
+if ENABLE_ADMIN_ANALYTICS:
+ app.include_router(analytics.router, prefix="/api/v1/analytics", tags=["analytics"])
app.include_router(utils.router, prefix="/api/v1/utils", tags=["utils"])
# SCIM 2.0 API for identity management
@@ -2120,6 +2122,7 @@ async def get_app_config(request: Request):
"enable_user_status": app.state.config.ENABLE_USER_STATUS,
"enable_admin_export": ENABLE_ADMIN_EXPORT,
"enable_admin_chat_access": ENABLE_ADMIN_CHAT_ACCESS,
+ "enable_admin_analytics": ENABLE_ADMIN_ANALYTICS,
"enable_google_drive_integration": app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION,
"enable_onedrive_integration": app.state.config.ENABLE_ONEDRIVE_INTEGRATION,
"enable_memories": app.state.config.ENABLE_MEMORIES,
diff --git a/src/lib/stores/index.ts b/src/lib/stores/index.ts
index 5bde46b4a6..3056c08459 100644
--- a/src/lib/stores/index.ts
+++ b/src/lib/stores/index.ts
@@ -275,6 +275,7 @@ type Config = {
enable_image_generation: boolean;
enable_admin_export: boolean;
enable_admin_chat_access: boolean;
+ enable_admin_analytics: boolean;
enable_community_sharing: boolean;
enable_memories: boolean;
enable_autocomplete_generation: boolean;
diff --git a/src/routes/(app)/admin/+layout.svelte b/src/routes/(app)/admin/+layout.svelte
index 6577cdabef..eee197ce6e 100644
--- a/src/routes/(app)/admin/+layout.svelte
+++ b/src/routes/(app)/admin/+layout.svelte
@@ -2,7 +2,7 @@
import { onMount, getContext } from 'svelte';
import { goto } from '$app/navigation';
- import { WEBUI_NAME, mobile, showSidebar, user } from '$lib/stores';
+ import { WEBUI_NAME, config, mobile, showSidebar, user } from '$lib/stores';
import { page } from '$app/stores';
import Tooltip from '$lib/components/common/Tooltip.svelte';
@@ -66,12 +66,14 @@
href="/admin">{$i18n.t('Users')}
+ {#if $config?.features.enable_admin_analytics ?? true}
{$i18n.t('Analytics')}
+ {/if}