forked from Ivasoft/geovisio-website
Feat/add matomo analytics
This commit is contained in:
committed by
Andreani Jean
parent
1bd41002af
commit
707420c69e
@@ -35,6 +35,7 @@
|
||||
"vue-draggable-resizable-vue3": "^2.3.1-beta.13",
|
||||
"vue-eslint-parser": "^9.1.0",
|
||||
"vue-i18n": "9.2.2",
|
||||
"vue-matomo": "^4.2.0",
|
||||
"vue-meta": "^3.0.0-alpha.10",
|
||||
"vue-router": "^4.1.6",
|
||||
"vue3-cookies": "^1.0.6",
|
||||
|
||||
20
src/main.ts
20
src/main.ts
@@ -1,5 +1,6 @@
|
||||
import { createApp } from 'vue'
|
||||
import { createI18n } from 'vue-i18n'
|
||||
import VueMatomo from 'vue-matomo'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import axios from 'axios'
|
||||
@@ -17,8 +18,17 @@ import 'bootstrap/dist/css/bootstrap.css'
|
||||
import 'bootstrap-icons/font/bootstrap-icons.css'
|
||||
import 'geovisio/build/index.css'
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
_paq: any[]
|
||||
}
|
||||
}
|
||||
|
||||
axios.defaults.baseURL = import.meta.env.VITE_API_URL
|
||||
axios.defaults.withCredentials = true
|
||||
const matomoHost = import.meta.env.VITE_MATOMO_HOST
|
||||
const matomoSiteId = import.meta.env.VITE_MATOMO_SITE_ID
|
||||
const matomoExist = matomoHost && matomoSiteId
|
||||
|
||||
const i18n = createI18n({
|
||||
locale: navigator.language.split('-')[0],
|
||||
@@ -34,7 +44,6 @@ const i18n = createI18n({
|
||||
})
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
app.use(pinia)
|
||||
app.use(i18n)
|
||||
app.use(router)
|
||||
@@ -43,4 +52,13 @@ app.provide('axios', app.config.globalProperties.axios)
|
||||
app.use(createMetaManager())
|
||||
app.use(VueDraggableResizable)
|
||||
app.use(VCalendar)
|
||||
if (matomoExist) {
|
||||
app.use(VueMatomo, {
|
||||
host: matomoHost,
|
||||
siteId: matomoExist
|
||||
})
|
||||
}
|
||||
app.mount('#app')
|
||||
if (matomoExist) {
|
||||
window._paq.push(['trackPageView']) // Pour suivre les visites sur vos pages
|
||||
}
|
||||
|
||||
1
vue-matomo.d.ts
vendored
Normal file
1
vue-matomo.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare module 'vue-matomo'
|
||||
@@ -8139,6 +8139,11 @@ vue-i18n@9.2.2:
|
||||
"@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-meta@^3.0.0-alpha.10:
|
||||
version "3.0.0-alpha.10"
|
||||
resolved "https://registry.yarnpkg.com/vue-meta/-/vue-meta-3.0.0-alpha.10.tgz#8aa7dee8ef43edda2633d52d2d4ca0ae03352222"
|
||||
|
||||
Reference in New Issue
Block a user