This commit is contained in:
qingwei.li 2017-06-11 18:57:21 +08:00
commit 97db30a0b9
No known key found for this signature in database
GPG key ID: B6DDC2F7AE80B2F4

View file

@ -7,24 +7,21 @@ function appendScript () {
} }
function init (id) { function init (id) {
let ga = window.ga
if (!ga) {
appendScript() appendScript()
ga = ga || function () { window.ga = window.ga || function () {
(ga.q = ga.q || []).push(arguments) (window.ga.q = window.ga.q || []).push(arguments)
} }
ga.l = Number(new Date()) window.ga.l = Number(new Date())
ga('create', id, 'auto') window.ga('create', id, 'auto')
}
return ga
} }
function collect () { function collect () {
const ga = init($docsify.ga) if (!window.ga) {
init($docsify.ga)
}
ga('set', 'page', location.hash) window.ga('set', 'page', location.hash)
ga('send', 'pageview') window.ga('send', 'pageview')
} }
const install = function (hook) { const install = function (hook) {