yandex添加
This commit is contained in:
@@ -263,7 +263,7 @@ APP_DEEP_LINK_URL=
|
|||||||
|
|
||||||
平台地址未配置时,按钮显示“前往下载页”,沿用上游 `AppAddr` 或 `/app/download/` 跳转;未配置 App 深链时隐藏打开 App 入口。链接保留原始跳转地址,不生成设计示例中的安装包、描述文件或 App Store 地址。
|
平台地址未配置时,按钮显示“前往下载页”,沿用上游 `AppAddr` 或 `/app/download/` 跳转;未配置 App 深链时隐藏打开 App 入口。链接保留原始跳转地址,不生成设计示例中的安装包、描述文件或 App Store 地址。
|
||||||
|
|
||||||
谷歌统计(GA4)由 `GOOGLE_ANALYTICS_ID` 配置,三套环境默认 `G-269F3ZFQFQ`,在根布局通过 `next/script` 于页面可交互后加载;留空即关闭。
|
谷歌统计(GA4)由 `GOOGLE_ANALYTICS_ID` 配置,三套环境默认 `G-269F3ZFQFQ`,在根布局通过 `next/script` 于页面可交互后加载;留空即关闭。Yandex.Metrika 由 `YANDEX_METRIKA_ID` 配置,三套环境默认 `113657403`,同样在根布局加载并带 noscript 像素;留空即关闭。
|
||||||
|
|
||||||
所有 Telegram 联系入口(页尾、官方导航、回家的路、播放页链接、2257/DMCA、意见反馈,以及 Telegram 形式的「联系我们」客服链接)统一使用 `CONTACT_TELEGRAM_URL`,三套环境默认 `https://t.me/jbd125`,覆盖上游 `tgGroup`、`telegram`、`telegramAdd`。值无效时回退为默认账号。
|
所有 Telegram 联系入口(页尾、官方导航、回家的路、播放页链接、2257/DMCA、意见反馈,以及 Telegram 形式的「联系我们」客服链接)统一使用 `CONTACT_TELEGRAM_URL`,三套环境默认 `https://t.me/jbd125`,覆盖上游 `tgGroup`、`telegram`、`telegramAdd`。值无效时回退为默认账号。
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ SEO_BAIDU_SITE_VERIFICATION=
|
|||||||
SEO_BAIDU_HTML_FILE=
|
SEO_BAIDU_HTML_FILE=
|
||||||
# Google Analytics 4 measurement ID; leave empty to disable.
|
# Google Analytics 4 measurement ID; leave empty to disable.
|
||||||
GOOGLE_ANALYTICS_ID=G-269F3ZFQFQ
|
GOOGLE_ANALYTICS_ID=G-269F3ZFQFQ
|
||||||
|
# Yandex.Metrika counter ID; leave empty to disable.
|
||||||
|
YANDEX_METRIKA_ID=113657403
|
||||||
# Telegram contact for every TG entry (footer, navigation, return-home, legal pages, customer service).
|
# Telegram contact for every TG entry (footer, navigation, return-home, legal pages, customer service).
|
||||||
CONTACT_TELEGRAM_URL=https://t.me/jbd125
|
CONTACT_TELEGRAM_URL=https://t.me/jbd125
|
||||||
APP_IOS_STORE_URL=
|
APP_IOS_STORE_URL=
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ SEO_BAIDU_SITE_VERIFICATION=
|
|||||||
SEO_BAIDU_HTML_FILE=
|
SEO_BAIDU_HTML_FILE=
|
||||||
# Google Analytics 4 measurement ID; leave empty to disable.
|
# Google Analytics 4 measurement ID; leave empty to disable.
|
||||||
GOOGLE_ANALYTICS_ID=G-269F3ZFQFQ
|
GOOGLE_ANALYTICS_ID=G-269F3ZFQFQ
|
||||||
|
# Yandex.Metrika counter ID; leave empty to disable.
|
||||||
|
YANDEX_METRIKA_ID=113657403
|
||||||
# Telegram contact for every TG entry (footer, navigation, return-home, legal pages, customer service).
|
# Telegram contact for every TG entry (footer, navigation, return-home, legal pages, customer service).
|
||||||
CONTACT_TELEGRAM_URL=https://t.me/jbd125
|
CONTACT_TELEGRAM_URL=https://t.me/jbd125
|
||||||
APP_IOS_STORE_URL=
|
APP_IOS_STORE_URL=
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ SEO_BAIDU_SITE_VERIFICATION=
|
|||||||
SEO_BAIDU_HTML_FILE=
|
SEO_BAIDU_HTML_FILE=
|
||||||
# Google Analytics 4 measurement ID; leave empty to disable.
|
# Google Analytics 4 measurement ID; leave empty to disable.
|
||||||
GOOGLE_ANALYTICS_ID=G-269F3ZFQFQ
|
GOOGLE_ANALYTICS_ID=G-269F3ZFQFQ
|
||||||
|
# Yandex.Metrika counter ID; leave empty to disable.
|
||||||
|
YANDEX_METRIKA_ID=113657403
|
||||||
# Telegram contact for every TG entry (footer, navigation, return-home, legal pages, customer service).
|
# Telegram contact for every TG entry (footer, navigation, return-home, legal pages, customer service).
|
||||||
CONTACT_TELEGRAM_URL=https://t.me/jbd125
|
CONTACT_TELEGRAM_URL=https://t.me/jbd125
|
||||||
APP_IOS_STORE_URL=
|
APP_IOS_STORE_URL=
|
||||||
|
|||||||
+2
-1
@@ -39,6 +39,7 @@ import "@/styles/overrides/pwa-safe-area.css";
|
|||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import { PwaProvider } from "@/components/pwa/PwaProvider";
|
import { PwaProvider } from "@/components/pwa/PwaProvider";
|
||||||
import { GoogleAnalytics } from "@/components/analytics/GoogleAnalytics";
|
import { GoogleAnalytics } from "@/components/analytics/GoogleAnalytics";
|
||||||
|
import { YandexMetrika } from "@/components/analytics/YandexMetrika";
|
||||||
import { serverConfig } from "@/server/config";
|
import { serverConfig } from "@/server/config";
|
||||||
import { pwaViewport } from "@/lib/pwa/config";
|
import { pwaViewport } from "@/lib/pwa/config";
|
||||||
import { getRequestPage } from "@/server/react/request-page";
|
import { getRequestPage } from "@/server/react/request-page";
|
||||||
@@ -83,7 +84,7 @@ export default async function RootLayout({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</head>
|
</head>
|
||||||
<body className={presentation.bodyClass}><PwaProvider />{children}<GoogleAnalytics id={serverConfig().googleAnalyticsID} /></body>
|
<body className={presentation.bodyClass}><PwaProvider />{children}<GoogleAnalytics id={serverConfig().googleAnalyticsID} /><YandexMetrika id={serverConfig().yandexMetrikaID} /></body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import Script from "next/script";
|
||||||
|
|
||||||
|
/** Yandex.Metrika counter; loads after hydration, with the official noscript pixel. */
|
||||||
|
export function YandexMetrika({ id }: { id: string }) {
|
||||||
|
if (!id) return null;
|
||||||
|
const src = `https://mc.yandex.ru/metrika/tag.js?id=${id}`;
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Script id="yandex-metrika" strategy="afterInteractive">
|
||||||
|
{`(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};m[i].l=1*new Date();for(var j=0;j<document.scripts.length;j++){if(document.scripts[j].src===r){return;}}k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})(window,document,'script',${JSON.stringify(src)},'ym');ym(${id},'init',{ssr:true,webvisor:true,clickmap:true,ecommerce:"dataLayer",referrer:document.referrer,url:location.href,accurateTrackBounce:true,trackLinks:true});`}
|
||||||
|
</Script>
|
||||||
|
<noscript>
|
||||||
|
<div>
|
||||||
|
<img
|
||||||
|
src={`https://mc.yandex.ru/watch/${id}`}
|
||||||
|
style={{ position: "absolute", left: "-9999px" }}
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</noscript>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -27,6 +27,8 @@ export function serverConfig() {
|
|||||||
navigationOnly: process.env.NAVIGATION_ONLY === 'true',
|
navigationOnly: process.env.NAVIGATION_ONLY === 'true',
|
||||||
/** Google Analytics 4 measurement ID; empty or invalid disables the Google tag. */
|
/** Google Analytics 4 measurement ID; empty or invalid disables the Google tag. */
|
||||||
googleAnalyticsID: /^G-[A-Z0-9]{4,20}$/.test((process.env.GOOGLE_ANALYTICS_ID || '').trim()) ? (process.env.GOOGLE_ANALYTICS_ID || '').trim() : '',
|
googleAnalyticsID: /^G-[A-Z0-9]{4,20}$/.test((process.env.GOOGLE_ANALYTICS_ID || '').trim()) ? (process.env.GOOGLE_ANALYTICS_ID || '').trim() : '',
|
||||||
|
/** Yandex.Metrika counter ID; empty or invalid disables the counter. */
|
||||||
|
yandexMetrikaID: /^\d{4,12}$/.test((process.env.YANDEX_METRIKA_ID || '').trim()) ? (process.env.YANDEX_METRIKA_ID || '').trim() : '',
|
||||||
/** Every Telegram contact entry points here, overriding the upstream tgGroup/telegram/telegramAdd. */
|
/** Every Telegram contact entry points here, overriding the upstream tgGroup/telegram/telegramAdd. */
|
||||||
contactTelegramURL: installationURL(process.env.CONTACT_TELEGRAM_URL) || 'https://t.me/jbd125',
|
contactTelegramURL: installationURL(process.env.CONTACT_TELEGRAM_URL) || 'https://t.me/jbd125',
|
||||||
installation: {
|
installation: {
|
||||||
|
|||||||
Reference in New Issue
Block a user