mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-18 03:54:46 +08:00
feat: integrated with Amplitude in static website mode
This commit is contained in:
@@ -5,8 +5,10 @@ import "~/styles/globals.css";
|
||||
|
||||
import { type Metadata } from "next";
|
||||
import { Geist } from "next/font/google";
|
||||
import Script from "next/script";
|
||||
|
||||
import { ThemeProviderWrapper } from "~/components/deer-flow/theme-provider-wrapper";
|
||||
import { env } from "~/env";
|
||||
|
||||
import { Toaster } from "../components/deer-flow/toaster";
|
||||
|
||||
@@ -30,6 +32,20 @@ export default function RootLayout({
|
||||
<body className="bg-app">
|
||||
<ThemeProviderWrapper>{children}</ThemeProviderWrapper>
|
||||
<Toaster />
|
||||
{
|
||||
// NO USER BEHAVIOR TRACKING OR PRIVATE DATA COLLECTION BY DEFAULT
|
||||
//
|
||||
// When `NEXT_PUBLIC_STATIC_WEBSITE_ONLY` is `true`, the script will be injected
|
||||
// into the page only when `AMPLITUDE_API_KEY` is provided in `.env`
|
||||
}
|
||||
{env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY && env.AMPLITUDE_API_KEY && (
|
||||
<>
|
||||
<Script src="https://cdn.amplitude.com/script/d2197dd1df3f2959f26295bb0e7e849f.js"></Script>
|
||||
<Script id="amplitude-init" strategy="lazyOnload">
|
||||
{`window.amplitude.init('${env.AMPLITUDE_API_KEY}', {"fetchRemoteConfig":true,"autocapture":true});`}
|
||||
</Script>
|
||||
</>
|
||||
)}
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user