Skip to content

Commit adf39dd

Browse files
committed
Add back matomo - was forgotten - and make it activable on-demand, disabled in dev
1 parent 33c54ea commit adf39dd

File tree

6 files changed

+33
-2
lines changed

6 files changed

+33
-2
lines changed

dev/zimit_ui_dev/config.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,9 @@
4747
],
4848
"zimit_size_limit": 2147483648,
4949
"zimit_time_limit": 5400,
50-
"zimit_refresh_after": 60
50+
"zimit_refresh_after": 60,
51+
"matomo_enabled": false,
52+
"matomo_host": "",
53+
"matomo_site_id": 0,
54+
"matomo_tracker_file_name": "matomo"
5155
}

ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"pinia": "^2.2.2",
1818
"vue": "^3.5.6",
1919
"vue-i18n": "10.0.1",
20+
"vue-matomo": "^4.2.0",
2021
"vue-router": "^4.4.5",
2122
"vuetify": "^3.7.1"
2223
},

ui/public/config.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,9 @@
4747
],
4848
"zimit_size_limit": 2147483648,
4949
"zimit_time_limit": 5400,
50-
"zimit_refresh_after": 60
50+
"zimit_refresh_after": 60,
51+
"matomo_enabled": false,
52+
"matomo_host": "",
53+
"matomo_site_id": 0,
54+
"matomo_tracker_file_name": "matomo"
5155
}

ui/src/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export type Config = {
1818
zimit_size_limit: number
1919
zimit_time_limit: number
2020
zimit_refresh_after: number
21+
matomo_enabled: boolean
22+
matomo_host: string
23+
matomo_site_id: number
24+
matomo_tracker_file_name: string
2125
}
2226

2327
async function loadConfig() {

ui/src/main.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,26 @@ import loadI18n, { i18nPlugin } from './i18n'
4747
// config
4848
import loadConfig, { configPlugin } from './config'
4949

50+
// Matomo stats
51+
import VueMatomo from 'vue-matomo'
52+
5053
// load translation asynchronously and only then mount the app
5154
Promise.all([loadI18n(), loadConfig()]).then(([i18n, config]) => {
5255
app.use(vuetify)
5356
app.use(router)
5457
app.use(pinia)
5558
app.use(i18n)
5659

60+
// activate matomo stats
61+
if (config.matomo_enabled) {
62+
app.use(VueMatomo, {
63+
host: 'https://stats.kiwix.org',
64+
siteId: 11,
65+
trackerFileName: 'matomo',
66+
router: router
67+
})
68+
}
69+
5770
// provide config app-wide
5871
app.provide(constants.config, config)
5972

ui/yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2648,6 +2648,11 @@ [email protected]:
26482648
"@intlify/shared" "10.0.1"
26492649
"@vue/devtools-api" "^6.5.0"
26502650

2651+
vue-matomo@^4.2.0:
2652+
version "4.2.0"
2653+
resolved "https://registry.yarnpkg.com/vue-matomo/-/vue-matomo-4.2.0.tgz#d65e369e4ead1d95ef790bef3627512cac3d25e9"
2654+
integrity sha512-m5hCw7LH3wPDcERaF4sp/ojR9sEx7Rl8TpOyH/4jjQxMF2DuY/q5pO+i9o5Dx+BXLSa9+IQ0qhAbWYRyESQXmA==
2655+
26512656
vue-router@^4.4.5:
26522657
version "4.4.5"
26532658
resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-4.4.5.tgz#bdf535e4cf32414ebdea6b4b403593efdb541388"

0 commit comments

Comments
 (0)