diff --git a/app/config/server.ts b/app/config/server.ts
index 5bfa2c2df11..e953af369fa 100644
--- a/app/config/server.ts
+++ b/app/config/server.ts
@@ -1,5 +1,5 @@
import md5 from "spark-md5";
-import { DEFAULT_MODELS } from "../constant";
+import { DEFAULT_MODELS, DEFAULT_GA_ID } from "../constant";
declare global {
namespace NodeJS {
@@ -211,6 +211,7 @@ export const getServerSideConfig = () => {
cloudflareKVTTL: process.env.CLOUDFLARE_KV_TTL,
gtmId: process.env.GTM_ID,
+ gaId: process.env.GA_ID || DEFAULT_GA_ID,
needCode: ACCESS_CODES.size > 0,
code: process.env.CODE,
diff --git a/app/constant.ts b/app/constant.ts
index d21f18f5a37..6fa28ad2bdf 100644
--- a/app/constant.ts
+++ b/app/constant.ts
@@ -474,4 +474,5 @@ export const internalAllowedWebDavEndpoints = [
"https://app.koofr.net/dav/Koofr",
];
+export const DEFAULT_GA_ID = "G-89WN60ZK2E";
export const PLUGINS = [{ name: "Stable Diffusion", path: Path.Sd }];
diff --git a/app/layout.tsx b/app/layout.tsx
index eda5f43dd83..abefd69c1c9 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -6,7 +6,7 @@ import { getClientConfig } from "./config/client";
import type { Metadata, Viewport } from "next";
import { SpeedInsights } from "@vercel/speed-insights/next";
import { getServerSideConfig } from "./config/server";
-import { GoogleTagManager } from "@next/third-parties/google";
+import { GoogleTagManager, GoogleAnalytics } from "@next/third-parties/google";
const serverConfig = getServerSideConfig();
export const metadata: Metadata = {
@@ -56,6 +56,11 @@ export default function RootLayout({
>
)}
+ {serverConfig?.gaId && (
+ <>
+
+ >
+ )}