Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
nuxt-umami
Advanced tools
This is a fully-featured nuxt module that makes implementing Umami Analytics into your Nuxt project a breeze.
Heads up: There is a newer version compatible with Nuxt 3 that provides better types & developer experience. If you are currently using Nuxt 3, please upgrade to Nuxt Umami v2.
<script setup>
syntaxHeads up: Nuxt Umami v2 has a superior feature set. If you are currently using Nuxt 3, please upgrade to Nuxt Umami v2.
With pnpm
pnpm add -D nuxt-umami
Or, with npm
npm install -D nuxt-umami
Or, with yarn
yarn add -D nuxt-umami
Add the module to nuxt.config
:
// nuxt.config.ts (Nuxt 3)
export default defineNuxtConfig({
modules: ['nuxt-umami'],
umami: {
enable: true, // enable the module? true by default
autoTrack: true,
doNotTrack: false,
cache: false,
domains: 'mywebsite.com,mywebsite2.com',
websiteId: 'your-website-id',
scriptUrl: 'https://path.to.umami.js',
}
})
// or inline config
export default defineNuxtConfig({
modules: [['nuxt-umami', {
// nuxt-umami options
}]]
})
// nuxt.config.js (Nuxt 2)
export default {
modules: [
['nuxt-umami'],
],
umami: {
autoTrack: true,
doNotTrack: false,
cache: false,
domains: 'mywebsite.com,mywebsite2.com',
websiteId: 'your-website-id',
scriptUrl: 'https://path.to.umami.js',
}
}
// or inline config
export default {
modules: [
['nuxt-umami', {
// nuxt-umami options
}]
]
}
Only websiteId
and scriptUrl
are mandatory. See the Umami docs for more explanation of these options.
New: Set the
enable
option tofalse
to disable the module (temporarily).
It's a bit of a hack, but adding
import {} from 'nuxt-umami';
to the top of your config might fix that.
If you want, you can set up and use environment variables in .env
files. But that is not really necessary as the module config does not require any "sensitive" data. Every part of the configuration can be viewed in the script in <head>
after the page is loaded.
Note: You can use
$umami
anywhere you have access toNuxtApp
or theuseNuxtApp
composable (middleware, asyncData, etc).
Warning: $umami is only available
onMounted
.
<script setup>
<script setup>
const { $umami } = useNuxtApp();
onMounted(() => {
// Sends an event with an event type of custom.
$umami("Signup button click");
});
</script>
const { data } = await useAsyncData("mountains", (nuxtApp) => {
const { $umami } = nuxtApp();
// do something, return something
});
For a list of all available functions, see Umami Tracker Functions
useScriptTag
composable.Hi, I'm ML. I'm dedicated to contributing to open source and sharing my insights on Twitter. If you encounter any issues with my module, don't hesitate to open an issue. I'm always available to help and resolve any bugs.
Using the module in your app? Consider giving it a star 🌟. It'd mean the world to me.
FAQs
Integrate Umami Analytics into Nuxt
The npm package nuxt-umami receives a total of 856 weekly downloads. As such, nuxt-umami popularity was classified as not popular.
We found that nuxt-umami demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.