diff --git a/README.md b/README.md index 36f4ee6..c700c03 100644 --- a/README.md +++ b/README.md @@ -263,6 +263,8 @@ APP_DEEP_LINK_URL= 平台地址未配置时,按钮显示“前往下载页”,沿用上游 `AppAddr` 或 `/app/download/` 跳转;未配置 App 深链时隐藏打开 App 入口。链接保留原始跳转地址,不生成设计示例中的安装包、描述文件或 App Store 地址。 +谷歌统计(GA4)由 `GOOGLE_ANALYTICS_ID` 配置,三套环境默认 `G-269F3ZFQFQ`,在根布局通过 `next/script` 于页面可交互后加载;留空即关闭。 + 所有 Telegram 联系入口(页尾、官方导航、回家的路、播放页链接、2257/DMCA、意见反馈,以及 Telegram 形式的「联系我们」客服链接)统一使用 `CONTACT_TELEGRAM_URL`,三套环境默认 `https://t.me/jbd125`,覆盖上游 `tgGroup`、`telegram`、`telegramAdd`。值无效时回退为默认账号。 ## 接口和媒体 diff --git a/config/development.env b/config/development.env index 986b4d2..6f469cd 100644 --- a/config/development.env +++ b/config/development.env @@ -17,6 +17,8 @@ M3U8_KEY_FILE=./config/secrets/m3u8.key SEO_INDEXNOW_KEY=d8e5b742d13809c10865fc3b29de24ee SEO_BAIDU_SITE_VERIFICATION= SEO_BAIDU_HTML_FILE= +# Google Analytics 4 measurement ID; leave empty to disable. +GOOGLE_ANALYTICS_ID=G-269F3ZFQFQ # Telegram contact for every TG entry (footer, navigation, return-home, legal pages, customer service). CONTACT_TELEGRAM_URL=https://t.me/jbd125 APP_IOS_STORE_URL= diff --git a/config/production.env b/config/production.env index 413eafe..2316d8d 100644 --- a/config/production.env +++ b/config/production.env @@ -13,6 +13,8 @@ M3U8_KEY_FILE=./config/secrets/m3u8.key SEO_INDEXNOW_KEY=d8e5b742d13809c10865fc3b29de24ee SEO_BAIDU_SITE_VERIFICATION= SEO_BAIDU_HTML_FILE= +# Google Analytics 4 measurement ID; leave empty to disable. +GOOGLE_ANALYTICS_ID=G-269F3ZFQFQ # Telegram contact for every TG entry (footer, navigation, return-home, legal pages, customer service). CONTACT_TELEGRAM_URL=https://t.me/jbd125 APP_IOS_STORE_URL= diff --git a/config/test.env b/config/test.env index 0cd4e99..4d88cbc 100644 --- a/config/test.env +++ b/config/test.env @@ -13,6 +13,8 @@ M3U8_KEY_FILE=./config/secrets/m3u8.key SEO_INDEXNOW_KEY=d8e5b742d13809c10865fc3b29de24ee SEO_BAIDU_SITE_VERIFICATION= SEO_BAIDU_HTML_FILE= +# Google Analytics 4 measurement ID; leave empty to disable. +GOOGLE_ANALYTICS_ID=G-269F3ZFQFQ # Telegram contact for every TG entry (footer, navigation, return-home, legal pages, customer service). CONTACT_TELEGRAM_URL=https://t.me/jbd125 APP_IOS_STORE_URL= diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 1140b8d..e35c71c 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -38,6 +38,8 @@ import "@/styles/pages/playback.css"; import "@/styles/overrides/pwa-safe-area.css"; import type { ReactNode } from "react"; import { PwaProvider } from "@/components/pwa/PwaProvider"; +import { GoogleAnalytics } from "@/components/analytics/GoogleAnalytics"; +import { serverConfig } from "@/server/config"; import { pwaViewport } from "@/lib/pwa/config"; import { getRequestPage } from "@/server/react/request-page"; import { toNextMetadata } from "@/server/seo"; @@ -81,7 +83,7 @@ export default async function RootLayout({ /> )} -