Skip to content

Privacy-Friendly Analytics with Umami

Track page views and events in your Nuxt app with the nuxt-umami module and a self-hosted Umami instance, or replace it with another analytics provider.

This starter kit uses the nuxt-umami module to track page views and events. This module is a wrapper around the Umami, making it easier to integrate with Nuxt applications.

The module is registered in the core layer (apps/web/layers/core/nuxt.config.ts). Set NUXT_UMAMI_HOST and NUXT_UMAMI_ID to connect your Umami instance.

Umami is an open-source, privacy-focused web analytics tool that serves as an alternative to Google Analytics. It provides essential insights into website traffic, user behavior, and performance, all while prioritizing data privacy.

My recommendation is to self-host Umami. You can find the instructions on how to do this in the Umami documentation.

Other Analytics Providers

If you prefer to use a different analytics provider, you can easily do so by following these steps:

  1. Uninstall the nuxt-umami module:
    pnpm --filter web remove nuxt-umami
    
  2. Remove the nuxt-umami module: Open apps/web/layers/core/nuxt.config.ts and remove the nuxt-umami module from the modules array:
    export default defineNuxtConfig({
      modules: [
        // Remove this line
        'nuxt-umami',
      ],
    })
    
  3. Remove the umami config from the same file and the NUXT_UMAMI_* variables from apps/web/.env.example, the Dockerfile secret mounts and your deployment environment variables.
  4. Install the new analytics module: Depending on the provider you choose, you may need to install a different Nuxt module or use a custom script tag.