
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
nuxt-matomo
Advanced tools
Add Matomo tracking to your nuxt.js application. This plugin automatically sends first page and route change events to matomo
nuxt-matomo is not enabled in
dev
mode unless you set the debug option
npm install --save nuxt-matomo
or use yarnnuxt-matomo
to modules
section of nuxt.config.js
modules: [
['nuxt-matomo', { matomoUrl: '//matomo.example.com/', siteId: 1 }],
]
You can add additional tracking info by adding a route.meta.matomo
object in a middleware and by adding a matomo object or function to your page component.
The VueRouter afterEach guard which this plugin uses is called before your page component is created
The matomo javascript tracker is also injected as $matomo
in your Nuxt instance to e.g. manually track a page view. See the injected and manuallytracked pages in the test fixture for an example
export default function ({ route, store }) {
route.meta.matomo = {
documentTitle: ['setDocumentTitle', 'Some other title'],
userId: ['setUserId', store.state.userId],
someVar: ['setCustomVariable', 1, 'VisitorType', 'Member']
}
}
<template>
<div>
<h1 v-if="expVarId === 1">New Content</h1>
<h1 v-else>Original Content</h1>
</div>
</template>
<script>
export default {
// the matomo function is binded to the tracker
matomo (from, to, store) {
this.setCustomVariable(1, 'VisitorType', 'Special Member')
},
// or let the function return an object
matomo (from, to, store) {
return {
someVar: ['setCustomVariable', 1, 'VisitorType', 'Special Member']
}
},
// or simply set an object
matomo: {
someVar: ['setCustomVariable', 1, 'VisitorType', 'Special Member']
},
[...]
}
</script>
The plugin extends the matomo tracker with a setConsent(<consentGiven>)
convenience method.
When setConsent()
is called, the plugin will automatically call rememberConsentGiven when the module option consentExpires has been set. To forget consent you can pass false to this method.
See the default layout in the test fixture for how to use this method in combination with a Vuex store.
siteId
(required)The matomo siteId
matomoUrl
Url to matomo installationtrackerUrl
matomoUrl + 'piwik.php'
Url to piwik.phpscriptUrl
matomoUrl + 'piwik.js'
Url to piwik.jscookies
true
If false, Matomo will not create a tracking cookieconsentRequired
false
If true, Matomo will not start tracking until the user has given consentconsentExpires
0
If greater than 0 and when the tracker.setConsent
method is called then we call rememberConsentGiven(<consentExpires>)
instead of setConsentGiven
. See below for more informationdoNotTrack
false
If true, dont track users who have set Mozilla's (proposed) Do Not Track settingdebug
false
If true, the plugin will log debug information to the console.The plugin also logs debug information when Nuxt's debug option is set
verbose
false
If true, the plugin will log every tracker function call to the consoleFAQs
Matomo analytics for Nuxt.js
The npm package nuxt-matomo receives a total of 1,348 weekly downloads. As such, nuxt-matomo popularity was classified as popular.
We found that nuxt-matomo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.