init
This commit is contained in:
33
app/BaiDuAnalytics.tsx
Normal file
33
app/BaiDuAnalytics.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
"use client";
|
||||
|
||||
import Script from "next/script";
|
||||
|
||||
const BaiDuAnalytics = () => {
|
||||
return (
|
||||
<>
|
||||
{process.env.NEXT_PUBLIC_BAIDU_TONGJI ? (
|
||||
<>
|
||||
<Script
|
||||
id="baidu-tongji"
|
||||
strategy="afterInteractive"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
var _hmt = _hmt || [];
|
||||
(function() {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "https://hm.baidu.com/hm.js?${process.env.NEXT_PUBLIC_BAIDU_TONGJI}";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default BaiDuAnalytics;
|
||||
Reference in New Issue
Block a user