- Add
@openmost/nuxt-matomo
dependency to your project
# Using pnpm
pnpm add -D @openmost/nuxt-matomo
# Using yarn
yarn add --dev @openmost/nuxt-matomo
# Using npm
npm install --save-dev @openmost/nuxt-matomo
- Add
@openmost/nuxt-matomo
to themodules
section ofnuxt.config.ts
export default defineNuxtConfig({
modules: [
'@openmost/nuxt-matomo'
]
})
Define variables to your .env
file:
NUXT_MATOMO_HOST=https://matomo.my-website.com
NUXT_MATOMO_ID_SITE=1
NUXT_MATOMO_ID_CONTAINER=XXXXXXX
Then register config in the matomo
section to your nuxt.config.ts
:
runtimeConfig: {
public: {
matomo: {
host: process.env.NUXT_MATOMO_HOST,
idSite: process.env.NUXT_MATOMO_ID_SITE,
idContainer: process.env.NUXT_MATOMO_ID_CONTAINER,
}
}
}
Enable or disable features using the matomo
key in nuxt.config.js
:
export default defineNuxtConfig({
matomo: {
enableHeartBeatTimer: true,
heartBeatTimerActiveTime: 700
},
})