// From https://github.com/egoist/vue-ga/blob/master/src/index.js
function appendScript () {
  const script = document.createElement('script')
  script.async = true
  script.src = 'https://www.google-analytics.com/analytics.js'
  document.body.appendChild(script)
}

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')
  }
  return ga
}

function collect () {
  const ga = init($docsify.ga)

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

const install = function (hook) {
  if (!$docsify.ga) {
    console.error('[Docsify] ga is required.')
    return
  }

  hook.beforeEach(collect)
}

$docsify.plugins = [].concat(install, $docsify.plugins)

@@ -287,69 +287,44 @@
 %7B%0A  
-let ga = window.ga%0A%0A  if (!ga) %7B%0A    appendScript()%0A    ga = 
+appendScript()%0A  window.ga = window.
 ga %7C
@@ -343,22 +343,34 @@
 ) %7B%0A
-  
     (
-ga.q = 
+window.ga.q = window.
 ga.q
@@ -397,18 +397,21 @@
 ts)%0A
-  
   %7D%0A  
-  
+window.
 ga.l
@@ -434,18 +434,23 @@
 te())%0A  
-  
+window.
 ga('crea
@@ -470,24 +470,8 @@
 o')%0A
-  %7D%0A  return ga%0A
 %7D%0A%0Af
@@ -497,18 +497,29 @@
 %7B%0A  
-const ga =
+if (!window.ga) %7B%0A   
  ini
@@ -533,19 +533,30 @@
 ify.ga)%0A
-%0A
   
+%7D%0A%0A  window.
 ga('set'
@@ -582,16 +582,23 @@
 hash)%0A  
+window.
 ga('send

fix ga