# nuxt-umami-module

> Embed the Umami analytics library into Nuxt as `this.$umami`

Latest version **1.0.0** (published 2021-05-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install nuxt-umami-module
pnpm add nuxt-umami-module
yarn add nuxt-umami-module
bun add nuxt-umami-module
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-05-19 |
| First published | 2021-05-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Joe Pritchard |
| Maintainers | joe-pritchard |
| Keywords | nuxt, umami, vue, module, analytics |

## Links

- npm: https://www.npmjs.com/package/nuxt-umami-module
- Repository: https://github.com/joe-pritchard/nuxt-umami-module
- Homepage: https://github.com/joe-pritchard/nuxt-umami-module#readme
- Issues: https://github.com/joe-pritchard/nuxt-umami-module/issues
- npm.io page: https://npm.io/package/nuxt-umami-module

## Recent versions

- 1.0.0 (latest) — 2021-05-19

## README

# Nuxt Umami Module

Wrapper around the [Umami Analytics](https://umami.is/) package, exposed to your app as `this.$umami`




## Installation

Install with npm

```bash 
  npm install nuxt-umami-module

```

Or with yarn

```bash 
  yarn add nuxt-umami-module

```

### Configuration

Add the module to `nuxt.config.js`:

```javascript
{
  modules: [
    ['nuxt-umami-module', { 
        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](https://umami.is/docs/tracker-config) for more explanation of these options.

## Usage

### In a component

```javascript

// Sends an event with an event type of custom.
this.$umami('Signup button click')

// track a custom event with an event type of "signup"
// this.$umami.trackEvent(event_value, event_type, [url], [website_id])
this.$umami.trackEvent('Signup button click', 'signup')

// track a page view
this.$umami.trackView(url, [referrer], [website_id])

```

### in asyncData, or middleware etc, you can use $umami from Nuxt context, for example:
```javascript
export default ({ route, $umami }) => {
    $umami.trackView(route.fullPath)
}
```

All functions defined [in the Umami docs](https://umami.is/docs/tracker-functions) are available,
so read them for more info

---
_Source: https://npm.io/package/nuxt-umami-module · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
