File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 44
44
maxLevel : 4 ,
45
45
subMaxLevel : 2 ,
46
46
ga : 'UA-106147152-1' ,
47
+ matomo : {
48
+ host : '//matomo.thunderwave.de' ,
49
+ id : 6
50
+ } ,
47
51
name : 'docsify' ,
48
52
search : {
49
53
noData : {
84
88
< script src ="//unpkg.com/docsify/lib/docsify.min.js "> </ script >
85
89
< script src ="//unpkg.com/docsify/lib/plugins/search.min.js "> </ script >
86
90
< script src ="//unpkg.com/docsify/lib/plugins/ga.min.js "> </ script >
91
+ < script src ="//unpkg.com/docsify/lib/plugins/matomo.min.js "> </ script >
87
92
< script src ="//unpkg.com/prismjs/components/prism-bash.min.js "> </ script >
88
93
< script src ="//unpkg.com/prismjs/components/prism-markdown.min.js "> </ script >
89
94
< script src ="//unpkg.com/prismjs/components/prism-nginx.min.js "> </ script >
Original file line number Diff line number Diff line change
1
+ function appendScript ( options ) {
2
+ const script = document . createElement ( 'script' )
3
+ script . async = true
4
+ script . src = options . host + '/matomo.js'
5
+ document . body . appendChild ( script )
6
+ }
7
+
8
+ function init ( options ) {
9
+ window . _paq = window . _paq || [ ]
10
+ window . _paq . push ( [ 'trackPageView' ] )
11
+ window . _paq . push ( [ 'enableLinkTracking' ] )
12
+ setTimeout ( function ( ) {
13
+ appendScript ( options )
14
+ window . _paq . push ( [ 'setTrackerUrl' , options . host + '/matomo.php' ] )
15
+ window . _paq . push ( [ 'setSiteId' , options . id + '' ] )
16
+ } , 0 )
17
+ }
18
+
19
+ function collect ( ) {
20
+ if ( ! window . _paq ) {
21
+ init ( $docsify . matomo )
22
+ }
23
+ window . _paq . push ( [ 'setCustomUrl' , window . location . hash . substr ( 1 ) ] )
24
+ window . _paq . push ( [ 'setDocumentTitle' , document . title ] )
25
+ window . _paq . push ( [ 'trackPageView' ] )
26
+ }
27
+
28
+ const install = function ( hook ) {
29
+ if ( ! $docsify . matomo ) {
30
+ console . error ( '[Docsify] matomo is required.' )
31
+ return
32
+ }
33
+
34
+ hook . beforeEach ( collect )
35
+ }
36
+
37
+ $docsify . plugins = [ ] . concat ( install , $docsify . plugins )
You can’t perform that action at this time.
0 commit comments