diff --git a/package.json b/package.json index b9a5d16c..4e689018 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/main.js b/src/main.js index 3d95ed68..168b3e95 100644 --- a/src/main.js +++ b/src/main.js @@ -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" @@ -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) @@ -28,4 +45,6 @@ sync(store, router) app.mount("#app") +window._paq.push(['trackPageView']); // To track a page view + import "./assets/scss/bbmri.scss" diff --git a/yarn.lock b/yarn.lock index 70fc9f39..1b03857d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"