将如下代码添加到 index.html 的 </body>
标签前
<body>
<div id="root"></div>
<!-- 以下为添加代码块 -->
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
<!-- 判断生产环境和测试环境-- >
hm.src = '%REACT_APP_RUN_ENV%' === 'prod'
? "https://hm.baidu.com/hm.js?8f2623e240dd9012cc4b61155c5b6529" //生产
: "https://hm.baidu.com/hm.js?674b596cab583fc28239ca2d9024ea3a"; //测试
console.log(hm.src,"hm.src")
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</body>