diff --git a/src/env.js b/src/env.js
index c5a596031..f0552ffdf 100644
--- a/src/env.js
+++ b/src/env.js
@@ -55,7 +55,7 @@ const env = createEnv({
DATABASE_URL: process.env.DATABASE_URL,
NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,
NEXTAUTH_URL: process.env.NEXTAUTH_URL,
- NEXT_PUBLIC_DISABLE_ANALYTICS: process.env.NEXT_PUBLIC_DISABLE_ANALYTICS,
+ NEXT_PUBLIC_DISABLE_ANALYTICS: process.env.DISABLE_ANALYTICS,
DOCKER_HOST: process.env.DOCKER_HOST,
DOCKER_PORT: process.env.DOCKER_PORT,
VERCEL_URL: process.env.VERCEL_URL,
diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx
index 0a3006826..b91c890ab 100644
--- a/src/pages/_app.tsx
+++ b/src/pages/_app.tsx
@@ -46,6 +46,7 @@ function App(
environmentColorScheme: MantineColorScheme;
packageAttributes: ServerSidePackageAttributesType;
editModeEnabled: boolean;
+ analyticsEnabled: boolean;
config?: ConfigType;
primaryColor?: MantineTheme['primaryColor'];
secondaryColor?: MantineTheme['primaryColor'];
@@ -56,6 +57,7 @@ function App(
}>
) {
const { Component, pageProps } = props;
+ const analyticsEnabled = pageProps.analyticsEnabled ?? true;
// TODO: make mapping from our locales to moment locales
const language = getLanguageByCode(pageProps.session?.user?.language ?? 'en');
require(`dayjs/locale/${language.locale}.js`);
@@ -93,12 +95,12 @@ function App(
return (
<>
- {env.NEXT_PUBLIC_DISABLE_ANALYTICS !== 'true' && (
+ {analyticsEnabled === true && (
+ src="https://umami.homarr.dev/script.js"
+ data-website-id="f133f10c-30a7-4506-889c-3a803f328fa4"
+ strategy="lazyOnload"
+ />
)}
@@ -152,6 +154,8 @@ App.getInitialProps = async ({ ctx }: { ctx: GetServerSidePropsContext }) => {
);
}
+ const analyticsEnabled = env.NEXT_PUBLIC_DISABLE_ANALYTICS !== 'true';
+
const session = await getSession(ctx);
// Set the cookie language to the user language if it is not set correctly
@@ -164,6 +168,7 @@ App.getInitialProps = async ({ ctx }: { ctx: GetServerSidePropsContext }) => {
pageProps: {
...getActiveColorScheme(session, ctx),
packageAttributes: getServiceSidePackageAttributes(),
+ analyticsEnabled,
session,
locale: ctx.locale ?? 'en',
},