Skip to content

Commit

Permalink
Merge pull request #42 from zjy365/main
Browse files Browse the repository at this point in the history
fix BaiDuAnalytics
  • Loading branch information
yangchuansheng authored Jul 31, 2024
2 parents b87122c + 989c8cd commit fdb4588
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions projects/fastgpt/app/BaiDuAnalytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,16 @@
import Script from 'next/script';

const BaiDuAnalytics = () => {
const key = process.env.NEXT_PUBLIC_BAIDU_TONGJI;

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);
})();
`
}}
/>
</>
{key ? (
<Script
id="baidu-tongji"
strategy="afterInteractive"
src={`https://hm.baidu.com/hm.js?${key}`}
/>
) : (
<></>
)}
Expand Down

0 comments on commit fdb4588

Please sign in to comment.