Skip to content

Commit

Permalink
fix ga
Browse files Browse the repository at this point in the history
  • Loading branch information
QingWei-Li committed Jun 11, 2017
1 parent 3a0765e commit 97db30a
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/plugins/ga.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,21 @@ function appendScript () {
}

function init (id) {
let ga = window.ga

if (!ga) {
appendScript()
ga = ga || function () {
(ga.q = ga.q || []).push(arguments)
}
ga.l = Number(new Date())
ga('create', id, 'auto')
appendScript()
window.ga = window.ga || function () {
(window.ga.q = window.ga.q || []).push(arguments)
}
return ga
window.ga.l = Number(new Date())
window.ga('create', id, 'auto')
}

function collect () {
const ga = init($docsify.ga)
if (!window.ga) {
init($docsify.ga)
}

ga('set', 'page', location.hash)
ga('send', 'pageview')
window.ga('set', 'page', location.hash)
window.ga('send', 'pageview')
}

const install = function (hook) {
Expand Down

0 comments on commit 97db30a

Please sign in to comment.