Skip to content

Commit

Permalink
add matomo tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
Milos committed Feb 8, 2024
1 parent 9fb416e commit 964ab06
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"oidc-client-ts": "^2.1.0",
"sass-loader": "^13.2.0",
"vue": "^3.2.47",
"vue-matomo": "^4.2.0",
"vue-router": "^4.1.5",
"vue3-form-wizard": "^0.1.8",
"vuex": "^4.0.2",
Expand Down
21 changes: 20 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createApp } from "vue"
import App from "./App.vue"
import VueMatomo from 'vue-matomo'
import router from "./router"
import store from "./store"
import { sync } from "vuex-router-sync"
Expand All @@ -16,7 +17,23 @@ library.add(faPencil)
library.add(faTrash)
library.add(faDownload)

const app = createApp(App)
let matomoHost = ''
let matomoSiteId = 0
if(window.location.origin === 'http://localhost:8080') {
matomoHost = 'https://matomo.bbmri-eric.eu/'
matomoSiteId = 1
}else if(window.location.origin === 'https://negotiator.acc.bbmri-eric.eu') {
matomoHost = 'https://negotiator.acc.bbmri-eric.eu'
matomoSiteId = 2
}else if(window.location.origin === 'https://negotiator.bbmri-eric.eu') {
matomoHost = 'https://negotiator.bbmri-eric.eu'
matomoSiteId = 3
}

const app = createApp(App).use(VueMatomo, {
host: matomoHost,
siteId: matomoSiteId,
})

app.use(router)
app.use(store)
Expand All @@ -28,4 +45,6 @@ sync(store, router)

app.mount("#app")

window._paq.push(['trackPageView']); // To track a page view

import "./assets/scss/bbmri.scss"
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6720,6 +6720,11 @@ vue-loader@^17.0.0:
hash-sum "^2.0.0"
watchpack "^2.4.0"

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.1.5:
version "4.2.0"
resolved "https://registry.npmjs.org/vue-router/-/vue-router-4.2.0.tgz"
Expand Down

0 comments on commit 964ab06

Please sign in to comment.