Skip to content

Commit 2695246

Browse files
committed
chore: add motomo site tracking
1 parent 39c06a5 commit 2695246

File tree

4 files changed

+53
-12
lines changed

4 files changed

+53
-12
lines changed

nuxt.config.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,28 @@ export default defineNuxtConfig({
4141
injectPosition: 0,
4242
viewer: true,
4343
},
44+
plugins: [
45+
{
46+
src: '~/plugins/matomo-plugin.client.js',
47+
ssr: false,
48+
},
49+
],
4450
// REF: https://v3.nuxtjs.org/guide/going-further/runtime-config/
4551
runtimeConfig: {
4652
// Keys within public, will be also exposed to the client-side
4753
public: {
48-
communityApiUrl: "https://community.api.josa.dev/v2",
49-
targetEnv: "",
50-
buildCommitSha: "",
51-
buildCommitLink: "",
52-
buildNumber: "",
53-
buildLink: "",
54-
buildRepoLink: "",
55-
buildTimestamp: "",
56-
debug: "",
57-
sessionCookieName: "connect.sid",
54+
communityApiUrl: 'https://community.api.josa.dev/v2',
55+
targetEnv: '',
56+
buildCommitSha: '',
57+
buildCommitLink: '',
58+
buildNumber: '',
59+
buildLink: '',
60+
buildRepoLink: '',
61+
buildTimestamp: '',
62+
debug: '',
63+
sessionCookieName: 'connect.sid',
64+
matomoSiteId: 13,
65+
matomoHost: 'https://analytics.josa.ngo',
5866
},
5967
},
6068
pwa: {

package-lock.json

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
},
2121
"dependencies": {
2222
"@nuxt/vite-builder": "^3.7.3",
23-
"@vuepic/vue-datepicker": "^4.0.1"
23+
"@vuepic/vue-datepicker": "^4.0.1",
24+
"vue-matomo": "^4.2.0"
2425
}
2526
}

plugins/matomo-plugin.client.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { defineNuxtPlugin } from '#app'
2+
import VueMatomo from 'vue-matomo'
3+
4+
export default defineNuxtPlugin((nuxtApp) => {
5+
const config = useRuntimeConfig()
6+
nuxtApp.vueApp.use(VueMatomo, {
7+
host: config.public.matomoHost,
8+
siteId: config.public.matomoSiteId,
9+
// Enables automatically registering pageviews on the router
10+
router: nuxtApp.$router,
11+
enableLinkTracking: true,
12+
requireConsent: false,
13+
trackInitialView: true,
14+
disableCookies: true,
15+
requireCookieConsent: false,
16+
})
17+
})

0 commit comments

Comments
 (0)