Skip to content

Commit

Permalink
Basic Matomo logging
Browse files Browse the repository at this point in the history
  • Loading branch information
arildm committed Sep 19, 2023
1 parent 08f4a5b commit b976bba
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ VITE_BACKEND_URL=https://ws.spraakbanken.gu.se/ws/mink/
VITE_AUTH_URL=https://sp.spraakbanken.gu.se/auth/
VITE_KORP_URL=https://spraakbanken.gu.se/korp/
VITE_STRIX_URL=https://spraakbanken.gu.se/strix/
VITE_MATOMO_URL=https://spraakbanken.gu.se/stats
# VITE_MATOMO_ID= # Do not report to the real backend when developing
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"vite-plugin-rewrite-all": "^1.0.1",
"vue": "^3.2.6",
"vue-i18n": "9",
"vue-matomo": "^4.2.0",
"vue-router": "4"
},
"devDependencies": {
Expand Down
17 changes: 14 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,25 @@ import { createPinia } from "pinia";
import i18n from "./i18n/i18n";
import { formkit, formkitConfig } from "./formkit";
import { FontAwesomeIcon } from "./fontawesome";
import matomo from "vue-matomo";
import "./index.css";

const pinia = createPinia();

createApp(App) //
const app = createApp(App) //
.use(router)
.use(pinia)
.use(i18n)
.use(formkit, formkitConfig)
.component("icon", FontAwesomeIcon)
.mount("#app");
.component("icon", FontAwesomeIcon);

// Use the Matomo plugin only if configured in env.
if (import.meta.env.VITE_MATOMO_URL && import.meta.env.VITE_MATOMO_ID) {
app.use(matomo, {
host: import.meta.env.VITE_MATOMO_URL,
siteId: import.meta.env.VITE_MATOMO_ID,
router: router,
});
}

app.mount("#app");
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2302,6 +2302,11 @@ vue-i18n@9:
"@intlify/vue-devtools" "9.2.2"
"@vue/devtools-api" "^6.2.1"

vue-matomo@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/vue-matomo/-/vue-matomo-4.2.0.tgz#d65e369e4ead1d95ef790bef3627512cac3d25e9"
integrity sha512-m5hCw7LH3wPDcERaF4sp/ojR9sEx7Rl8TpOyH/4jjQxMF2DuY/q5pO+i9o5Dx+BXLSa9+IQ0qhAbWYRyESQXmA==

vue-router@4:
version "4.1.6"
resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-4.1.6.tgz#b70303737e12b4814578d21d68d21618469375a1"
Expand Down

0 comments on commit b976bba

Please sign in to comment.