OSDN Git Service

feat: enable Google Analytics
authorIr1d <sirius.caffrey@gmail.com>
Thu, 23 Aug 2018 17:09:30 +0000 (01:09 +0800)
committerIr1d <sirius.caffrey@gmail.com>
Thu, 23 Aug 2018 17:09:30 +0000 (01:09 +0800)
docs/_static/js/extra.js
mkdocs.yml

index 08c714f..b41f975 100644 (file)
@@ -30,4 +30,10 @@ window.addEventListener('load', function() {
     if (a){
         document.body.setAttribute('data-md-color-accent',a);
     }
-}, false); 
\ No newline at end of file
+}, false);
+
+< !--Global site tag(gtag.js) - Google Analytics-- >
+window.dataLayer = window.dataLayer || [];
+function gtag(){dataLayer.push(arguments); }
+gtag('js', new Date());  
+gtag('config', 'UA-124485594-1');
index 88fc4d2..a1aba16 100644 (file)
@@ -232,6 +232,7 @@ extra:
   disqus: 'OI-Wiki'
 
 extra_javascript:
+  - 'https://oi-wiki.org/analytics.js'
   - '_static/js/extra.js'
   - 'https://cdn.bootcss.com/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML'