mirror of
https://github.com/ZiuChen/ZiuChen.github.io.git
synced 2025-08-17 23:19:55 +08:00
feat: 为页面跳转与路由切换添加埋点上报
This commit is contained in:
parent
3c6b310889
commit
ef911c284e
@ -1,7 +1,26 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
title: 'ZiuChen',
|
title: 'ZiuChen',
|
||||||
description: 'Unlimited Progress.',
|
description: 'Unlimited Progress.',
|
||||||
head: [['link', { rel: 'icon', href: '/logo.png' }]],
|
head: [
|
||||||
|
['link', { rel: 'icon', href: '/logo.png' }],
|
||||||
|
[
|
||||||
|
'script',
|
||||||
|
{},
|
||||||
|
/* js */ `
|
||||||
|
var _hmt = _hmt || [];
|
||||||
|
(function() {
|
||||||
|
var hm1 = document.createElement("script");
|
||||||
|
hm1.src = "https://hm.baidu.com/hm.js?08b4ef50a9244e83e5a1bd5822442829"; // gitee
|
||||||
|
var hm2 = document.createElement("script");
|
||||||
|
hm2.src = "https://hm.baidu.com/hm.js?50bac15a1f238d1aa61f104a5fb6f5e0"; // github
|
||||||
|
var s = document.getElementsByTagName("script")[0];
|
||||||
|
s.parentNode.insertBefore(hm1, s);
|
||||||
|
s.parentNode.insertBefore(hm2, s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
`
|
||||||
|
]
|
||||||
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
'@vuepress/medium-zoom',
|
'@vuepress/medium-zoom',
|
||||||
'@vuepress/active-header-links',
|
'@vuepress/active-header-links',
|
||||||
|
10
docs/.vuepress/enhanceApp.js
Normal file
10
docs/.vuepress/enhanceApp.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export default ({ router }) => {
|
||||||
|
router.beforeEach((to, from, next) => {
|
||||||
|
if (typeof _hmt !== 'undefined') {
|
||||||
|
if (to.path) {
|
||||||
|
_hmt.push(['_trackPageview', to.fullPath]) // 添加埋点上报
|
||||||
|
}
|
||||||
|
}
|
||||||
|
next() // 执行路由跳转
|
||||||
|
})
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user