百度统计代码调整

This commit is contained in:
hooray
2021-11-02 10:05:25 +08:00
parent 0d27d83731
commit 34fc5080a6
2 changed files with 9 additions and 14 deletions
+9 -8
View File
@@ -80,19 +80,20 @@
<% if (htmlWebpackPlugin.options.appType == 'example') { %>
<script>
var _hmt = _hmt || [];
_hmt.push(['_requirePlugin', 'UrlChangeTracker', {
shouldTrackUrlChange: function(newPath, oldPath) {
return newPath && oldPath;
}
}]);
(function() {
var hm = document.createElement("script");
if (location.origin.includes('gitee')) {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?ba0ee7b31f404b7dc10bfcd8bdc7183d";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
}
if (location.origin.includes('github')) {
var hm = document.createElement("script");
} else {
hm.src = "https://hm.baidu.com/hm.js?d07a64f7a02cd5e9c01e1b36948ac4a5";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<% } %>
-6
View File
@@ -189,12 +189,6 @@ router.beforeEach(async(to, from, next) => {
})
}
}
// 百度统计代码
if (process.env.VUE_APP_TYPE == 'example') {
if (window._hmt) {
window._hmt.push(['_trackPageview', location.pathname + '#' + to.fullPath])
}
}
next()
})