From a880a2dd17da7e786a336d7aac06a4fec0b9aec5 Mon Sep 17 00:00:00 2001 From: "huanqing.shao" Date: Fri, 29 Nov 2019 20:07:05 +0800 Subject: [PATCH] openOutboundLink --- .vuepress/enhanceApp.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.vuepress/enhanceApp.js b/.vuepress/enhanceApp.js index 0b3948f..13aa3cf 100644 --- a/.vuepress/enhanceApp.js +++ b/.vuepress/enhanceApp.js @@ -61,8 +61,15 @@ export default ({ } } + // Vue.prototype. + let sharing = true if (typeof window !== 'undefined') { + window.$sendGaEvent = Vue.prototype.$sendGaEvent + window.openOutboundLink = function (a) { + let url = new URL(a.href) + window.$sendGaEvent('OutboundLink: ' + url.hostname, 'OutboundLink: ' + a.innerText, 'OL:' + a.href) + } if (location.search && (location.search.indexOf('sharing') >=0 || location.search.indexOf('from=timeline') >= 0)) { sharing = true window.kuboardSharing = true