Nimble Prime Musketeers

    TypeScript icon, indicating that this package has built-in type declarations

    1.2.0 • Public • Published

    cover image

    Nuxt Umami Module

    npm Downloads License

    This is a fully featured nuxt module that makes implementing Umami Analytics into your Nuxt project a breeze.


    • 📖 Open Source
    • SSR support
    • 💯 Feature complete
    • TypeScript & JSDocs
    • Supports <script setup> syntax


    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: ',',
        websiteId: 'your-website-id',
        scriptUrl: '',
    // or inline config
    export default defineNuxtConfig({
      modules: [['nuxt-umami', {
        // nuxt-umami options
    // nuxt.config.js (Nuxt 2)
    export default {
      modules: [
      umami: {
        autoTrack: true,
        doNotTrack: false,
        cache: false,
        domains: ',',
        websiteId: 'your-website-id',
        scriptUrl: '',
    // 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: You can use the enable option to temporarily disable the module.

    Environment Variables

    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 to NuxtApp or the useNuxtApp composable (middleware, asyncData, etc).

    Warning: $umami is only available onMounted.

    In <script setup>

    <script setup>
    const { $umami } = useNuxtApp();
    onMounted(() => {
      // Sends an event with an event type of custom.
      $umami("Signup button click");

    In middleware, asyncData, etc

    const { data } = await useAsyncData("mountains", (nuxtApp) => {
      const { $umami } = nuxtApp();
      // do something, return something

    Available Functions

    For a list of all available functions, see Umami Tracker Functions


    • VueUse - for useScriptTag composable.
    • Joe Pritchard - author of nuxt-umami-module (compatible only with Nuxt 2).


    Hey, I'm ML, when I'm not trying to break into open source, I'm busy trying to break into sh-posting on Twitter
    If you find a bug or have any trouble using the module, please open an issue. I'm available to work on it and help you out.

    Using the module in your app? Consider giving it a star 🌟. It'd mean the world to me.



    npm i nuxt-umami

    DownloadsWeekly Downloads






    Unpacked Size

    18 kB

    Total Files


    Last publish


    • ijkml