diff --git a/.env b/.env
index cd0f2135..b19202c4 100644
--- a/.env
+++ b/.env
@@ -5,7 +5,7 @@ WORDPRESS_APP_PASSWORD=DlJH 49dp fC3a Itc3 Sl7Z Wz0k'
# Umami Analytics
NEXT_PUBLIC_UMAMI_WEBSITE_ID=59a7db94-0100-4c7e-98ef-99f45b17f9c3
-NEXT_PUBLIC_UMAMI_SCRIPT_URL=/stats/script.js
+NEXT_PUBLIC_UMAMI_SCRIPT_URL=https://analytics.infra.mintel.me/script.js
# GlitchTip (Sentry protocol)
SENTRY_DSN=https://c10957d0182245b1a2a806ac2d34a197@errors.infra.mintel.me/1
diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx
index 947737ef..2cd452e0 100644
--- a/app/[locale]/layout.tsx
+++ b/app/[locale]/layout.tsx
@@ -82,9 +82,6 @@ export default async function LocaleLayout({
- {/* Loads Umami only when NEXT_PUBLIC_UMAMI_WEBSITE_ID is set */}
-
-
{children}
diff --git a/components/analytics/AnalyticsProvider.tsx b/components/analytics/AnalyticsProvider.tsx
index 44d8c99b..3ff510a3 100644
--- a/components/analytics/AnalyticsProvider.tsx
+++ b/components/analytics/AnalyticsProvider.tsx
@@ -3,6 +3,7 @@
import { useEffect } from 'react';
import { usePathname, useSearchParams } from 'next/navigation';
import { getAppServices } from '@/lib/services/create-services';
+import Script from 'next/script';
/**
* AnalyticsProvider Component
@@ -40,6 +41,17 @@ export default function AnalyticsProvider() {
}
}, [pathname, searchParams]);
- return null;
+ const websiteId = process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID;
+ if (!websiteId) return null;
+
+ return (
+
+ );
}
diff --git a/components/analytics/UmamiScript.tsx b/components/analytics/UmamiScript.tsx
deleted file mode 100644
index 96b14734..00000000
--- a/components/analytics/UmamiScript.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-import Script from 'next/script';
-
-interface UmamiScriptProps {
- /**
- * Custom website ID to override the environment variable
- */
- websiteId?: string;
- /**
- * Custom script URL to override the environment variable
- */
- scriptUrl?: string;
-}
-
-/**
- * Umami Analytics Script Component
- *
- * Loads the Umami analytics script only when a website ID is available.
- * Uses Next.js Script component with 'afterInteractive' strategy for optimal performance.
- *
- * @example
- * ```tsx
- * // Uses environment variables automatically
- *
- *
- * // Or provide custom values
- *
- * ```
- */
-export default function UmamiScript({ websiteId, scriptUrl }: UmamiScriptProps) {
- // Use provided website ID or fall back to environment variable
- const finalWebsiteId = websiteId ?? process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID;
-
- // If no website ID is available, don't render the script
- if (!finalWebsiteId) {
- if (process.env.NODE_ENV === 'development') {
- console.warn('[Umami] NEXT_PUBLIC_UMAMI_WEBSITE_ID is not set. Analytics will be disabled.');
- }
- return null;
- }
-
- // Use provided script URL or fall back to environment variable or default
- const finalScriptUrl = scriptUrl ??
- process.env.NEXT_PUBLIC_UMAMI_SCRIPT_URL ??
- 'https://analytics.infra.mintel.me/script.js';
-
- return (
-