Socket
Socket
Sign inDemoInstall

nuxt-umami

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-umami

Embed the Umami analytics library into Nuxt


Version published
Weekly downloads
2.3K
increased by6.26%
Maintainers
1
Weekly downloads
 
Created
Source

Nuxt Umami Module


Features

  • SSR support
  • TypeScript & JSDocs
  • Feature complete
  • The <script setup> syntax

Installation


With pnpm

  pnpm add nuxt-umami

Or, with npm

  npm install nuxt-umami

Or, with yarn

  yarn add nuxt-umami

Configuration

Add the module to nuxt.config:

{
  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',
  }
}

Only websiteId and scriptUrl are mandatory. See the Umami docs for more explanation of these options.


Usage

You can use $umami anywhere you have access to NuxtApp or the useNuxtApp composable (middleware, asyncData, etc).

Note: $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')
});
</script>

In middleware, asyncData, etc

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

Credits

  • VueUse - for useScriptTag composable.
  • Joe Pritchard - author of the nuxt-umami-module for Nuxt 2.

Keywords

FAQs

Package last updated on 05 Aug 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc