Skip to content

Commit 4aae031

Browse files
committed
添加百度统计
1 parent 1928d5d commit 4aae031

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/pages/_app.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import '@/styles/globals.css'
22
import '../styles/pdf-experience.css'
33
import type { AppProps } from 'next/app'
44
import Head from 'next/head'
5+
import Script from 'next/script'
56
import { SpeedInsights } from '@vercel/speed-insights/next' // 👈 新增
67
import { Analytics } from "@vercel/analytics/next"
78

@@ -19,6 +20,18 @@ export default function App({ Component, pageProps }: AppProps) {
1920

2021
<script src="//code.tidio.co/wbkzxxrbm3ym4auqw0vjdxec3csyierl.js" async></script>
2122

23+
<Script id="baidu-analytics" strategy="afterInteractive">
24+
{`
25+
var _hmt = _hmt || [];
26+
(function() {
27+
var hm = document.createElement("script");
28+
hm.src = "https://hm.baidu.com/hm.js?f540d00118a713b3aa3454f1155ded86";
29+
var s = document.getElementsByTagName("script")[0];
30+
s.parentNode.insertBefore(hm, s);
31+
})();
32+
`}
33+
</Script>
34+
2235
{/* ✅ 包裹 Layout(可扩展导航、footer) */}
2336
<Component {...pageProps} />
2437
{/* ✅ 全局挂载 SpeedInsights */}

0 commit comments

Comments
 (0)