feat: 接入 Google Analytics (G-LVVXH3TL04)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import { cookies, headers } from "next/headers";
|
import { cookies, headers } from "next/headers";
|
||||||
|
import Script from "next/script";
|
||||||
import { DM_Sans, Fraunces } from "next/font/google";
|
import { DM_Sans, Fraunces } from "next/font/google";
|
||||||
import TabBar from "@/components/TabBar";
|
import TabBar from "@/components/TabBar";
|
||||||
import LanguageSwitcher from "@/components/LanguageSwitcher";
|
import LanguageSwitcher from "@/components/LanguageSwitcher";
|
||||||
@@ -41,6 +42,20 @@ export default async function RootLayout({
|
|||||||
lang={lang}
|
lang={lang}
|
||||||
className={`${fraunces.variable} ${dmSans.variable} h-full antialiased`}
|
className={`${fraunces.variable} ${dmSans.variable} h-full antialiased`}
|
||||||
>
|
>
|
||||||
|
<head>
|
||||||
|
<Script
|
||||||
|
src="https://www.googletagmanager.com/gtag/js?id=G-LVVXH3TL04"
|
||||||
|
strategy="afterInteractive"
|
||||||
|
/>
|
||||||
|
<Script id="google-analytics" strategy="afterInteractive">
|
||||||
|
{`
|
||||||
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
function gtag(){dataLayer.push(arguments);}
|
||||||
|
gtag('js', new Date());
|
||||||
|
gtag('config', 'G-LVVXH3TL04');
|
||||||
|
`}
|
||||||
|
</Script>
|
||||||
|
</head>
|
||||||
<body className={`min-h-full flex flex-col ${isInternal ? "" : "pb-16"} bg-cream dark:bg-[#1E1A14] text-ink dark:text-[#F3EFE8]`}>
|
<body className={`min-h-full flex flex-col ${isInternal ? "" : "pb-16"} bg-cream dark:bg-[#1E1A14] text-ink dark:text-[#F3EFE8]`}>
|
||||||
<I18nProvider>
|
<I18nProvider>
|
||||||
<main className="flex-1 max-w-2xl mx-auto w-full px-5 pt-8 pb-4 relative">
|
<main className="flex-1 max-w-2xl mx-auto w-full px-5 pt-8 pb-4 relative">
|
||||||
|
|||||||
Reference in New Issue
Block a user