change owner

This commit is contained in:
afred 2024-12-11 12:25:47 +08:00
parent 54774b1186
commit fd09d2fb15
1 changed files with 24 additions and 9 deletions

View File

@ -6,15 +6,30 @@ import { getServerSideConfig } from "./config/server";
const serverConfig = getServerSideConfig();
export default async function App() {
return (
<>
<Home />
{serverConfig?.isVercel && (
export default function App() {
// 使用 useEffect 加载 Hotjar 脚本
React.useEffect(() => {
if (serverConfig?.isVercel) {
(function (h, o, t, j, a, r) {
h.hj =
h.hj ||
function () {
(h.hj.q = h.hj.q || []).push(arguments);
};
h._hjSettings = { hjid: 3414362, hjsv: 6 };
a = o.getElementsByTagName("head")[0];
r = o.createElement("script");
r.async = 1;
r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv;
a.appendChild(r);
})(window, document, "https://static.hotjar.com/c/hotjar-", ".js?sv=");
}
}, []); // 空依赖数组,确保只在组件加载时运行一次
return (
<>
<Analytics />
<Home />
{serverConfig?.isVercel && <Analytics />}
</>
)}
</>
);
);
}