From f86bc05f2a35efd32bcb0fe4bac2a5cfcce574f2 Mon Sep 17 00:00:00 2001 From: "yongen.loong" Date: Fri, 15 Nov 2024 16:40:20 +0800 Subject: [PATCH] fix: ga --- .env | 2 +- app/layout.tsx | 5 ++--- lib/env.ts | 4 ---- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.env b/.env index 82aa027..8c481c0 100644 --- a/.env +++ b/.env @@ -1,7 +1,7 @@ BUILD_SERVER_BASE_URL=https://playground.test.aelf.dev SOLANG_BUILD_SERVER_BASE_URL=https://playground-next.test.aelf.dev SOLIDITY_ENABLED=false -GA_TAG= +NEXT_PUBLIC_GOOGLE_ANALYTICS_ID= GITHUB_API_KEY= NEXT_PUBLIC_FAUCET_API_URL= NEXT_PUBLIC_GOOGLE_CAPTCHA_SITEKEY= diff --git a/app/layout.tsx b/app/layout.tsx index 772c37a..9d69da1 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -5,10 +5,9 @@ import { PropsWithChildren, Suspense } from "react"; import TopMenu from "@/components/top-menu"; import clsx from "clsx"; import { GoogleAnalytics } from "@next/third-parties/google"; -import { getGoogleAnalyticsTag } from "@/lib/env"; import Providers from "@/components/providers"; import { Toaster } from "@/components/ui/toaster"; -import { PublicEnvScript } from 'next-runtime-env'; +import { env, PublicEnvScript } from 'next-runtime-env'; const font = Poppins({ weight: ["100", "200", "300", "400", "500", "600", "700", "800", "900"], @@ -22,7 +21,7 @@ export const metadata: Metadata = { }; export default function RootLayout({ children }: PropsWithChildren) { - const gaId = getGoogleAnalyticsTag(); + const gaId = env("NEXT_PUBLIC_GOOGLE_ANALYTICS_ID"); return ( diff --git a/lib/env.ts b/lib/env.ts index cb53ad4..434d5a5 100644 --- a/lib/env.ts +++ b/lib/env.ts @@ -14,10 +14,6 @@ export function getSolangBuildServerBaseUrl() { return getEnv("SOLANG_BUILD_SERVER_BASE_URL"); } -export function getGoogleAnalyticsTag() { - return getEnv("GA_TAG"); -} - export function getGitHubToken() { return getEnv("GITHUB_API_KEY"); }