This commit is contained in:
砂糖
2026-01-24 16:54:44 +08:00
commit 70f337bb92
186 changed files with 23792 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
"use client";
import Script from "next/script";
// 你可以将域名放在环境变量中,这里先直接使用你提供的域名
const PLAUSIBLE_DOMAIN = process.env.NEXT_PUBLIC_PLAUSIBLE_DOMAIN;
const PLAUSIBLE_SRC = process.env.NEXT_PUBLIC_PLAUSIBLE_SRC;
const PlausibleAnalytics = () => {
return (
<>
{PLAUSIBLE_DOMAIN ? (
<>
<Script
strategy="afterInteractive"
data-domain={PLAUSIBLE_DOMAIN}
src={PLAUSIBLE_SRC}
defer
/>
<Script
id="plausible-init"
strategy="afterInteractive"
dangerouslySetInnerHTML={{
__html: `
window.plausible = window.plausible || function() {
(window.plausible.q = window.plausible.q || []).push(arguments)
}
`,
}}
/>
</>
) : (
<></>
)}
</>
);
};
export default PlausibleAnalytics;