nuxt-umami
Advanced tools
Comparing version 1.2.1 to 2.0.0-beta.0
{ | ||
"name": "nuxt-umami", | ||
"type": "module", | ||
"version": "1.2.1", | ||
"private": false, | ||
"description": "Embed the Umami analytics library into Nuxt", | ||
"version": "2.0.0-beta.0", | ||
"main": "./nuxt.config.ts", | ||
"description": "Integrate Umami Analytics into Nuxt", | ||
"author": "ML <me.mlaure@gmail.com>", | ||
"license": "unlicense", | ||
"repository": "https://github.com/ijkml/nuxt-umami", | ||
"license": "MIT", | ||
"repository": "https://github.com/ijkml/nuxt-umami/tree/next", | ||
"keywords": [ | ||
"nuxt", | ||
"umami", | ||
"umami analytics", | ||
"analytics", | ||
"tracking", | ||
"nuxt module" | ||
"nuxt-umami", | ||
"nuxt layer", | ||
"nuxt module", | ||
"nuxt plugin" | ||
], | ||
"exports": { | ||
".": { | ||
"require": "./dist/module.cjs", | ||
"import": "./dist/module.mjs" | ||
} | ||
}, | ||
"main": "./dist/module.cjs", | ||
"types": "./dist/types.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"prepack": "nuxt-module-build", | ||
"dev": "nuxi dev playground", | ||
"dev:build": "nuxi build playground", | ||
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground", | ||
"dev": "nuxi prepare & nuxi dev .playground", | ||
"build": "nuxi build .playground", | ||
"generate": "nuxi generate .playground", | ||
"preview": "nuxi preview .playground", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix", | ||
"release": "npm run prepack && bumpp --commit --push --tag && npm publish --access public" | ||
"release": "bumpp --commit --push --tag && npm publish --access public --tag next" | ||
}, | ||
"dependencies": { | ||
"@nuxt/kit": "^3.0.0-rc.13" | ||
}, | ||
"devDependencies": { | ||
"@antfu/eslint-config-ts": "^0.35.1", | ||
"@nuxt/module-builder": "latest", | ||
"@nuxt/schema": "^3.0.0-rc.13", | ||
"@nuxt/types": "^2.15.8", | ||
"@nuxtjs/eslint-config-typescript": "latest", | ||
"@antfu/eslint-config": "^0.35.2", | ||
"@types/node": "^18.14.0", | ||
"bumpp": "^8.2.1", | ||
"eslint": "latest", | ||
"nuxt": "3.0.0-rc.13" | ||
"eslint": "^8.34.0", | ||
"eslint-plugin-vue": "^9.9.0", | ||
"nuxt": "^3.2.2", | ||
"typescript": "^4.9.5" | ||
} | ||
} |
198
README.md
@@ -1,5 +0,3 @@ | ||
![cover image](/preview/cover.png) | ||
# Nuxt Umami <sup>@next<sup> | ||
# Nuxt Umami Module | ||
[![npm](https://img.shields.io/npm/v/nuxt-umami.svg?style=flat-square)](https://www.npmjs.com/package/nuxt-umami) | ||
@@ -9,173 +7,97 @@ [![Downloads](https://img.shields.io/npm/dt/nuxt-umami.svg?style=flat-square)](https://www.npmjs.com/package/nuxt-umami) | ||
This is a fully featured nuxt module that makes implementing [**Umami Analytics**](https://umami.is/) into your Nuxt project a breeze. | ||
Deeply integrate [**Umami Analytics**](https://umami.is/) into your Nuxt websites / applications. | ||
> **Heads up:** | ||
> This version uses features (Nuxt Layers) that are only available in **Nuxt 3**. | ||
> Check out [Nuxt Umami v1](https://github.com/ijkml/nuxt-umami) for Nuxt 2 compat. | ||
## Features | ||
- 📖 Open Source | ||
- ✨ SSR support | ||
- 💯 Feature complete | ||
- ✅ TypeScript & JSDocs | ||
- ✅ Supports `<script setup>` syntax | ||
- ✨ SSR Support, of course | ||
- ➖ No extra script: no extra tag, no script loading, instant availability | ||
- 😜 Escapes ad & script blockers (catch me if you can) | ||
- 💯 Feature complete + extensive config | ||
- ✅ Better Typescript, JSDocs, auto completion | ||
- ✅ Error handling + debugging | ||
- ✅ Vue composables + auto import | ||
## Setup | ||
## Installation | ||
### Step 1: Installation and add to Nuxt | ||
With `pnpm` | ||
```bash | ||
pnpm add -D nuxt-umami | ||
``` | ||
Install using your favorite package manager... | ||
Or, with `npm` | ||
```bash | ||
npm install -D nuxt-umami | ||
pnpm add nuxt-umami@next #pnpm | ||
``` | ||
Or, with `yarn` | ||
```bash | ||
yarn add -D nuxt-umami | ||
npm install nuxt-umami@next #npm | ||
``` | ||
### Setup | ||
Then add `nuxt-umami` to your `extends` array in `nuxt.config`: | ||
Add the module to `nuxt.config`: | ||
```typescript | ||
// 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 | ||
}]] | ||
}) | ||
```ts | ||
defineNuxtConfig({ | ||
extends: ['nuxt-umami'] | ||
}); | ||
``` | ||
```javascript | ||
// 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, you can totally skip the installation process and do | ||
// or inline config | ||
export default { | ||
modules: [ | ||
['nuxt-umami', { | ||
// nuxt-umami options | ||
}] | ||
] | ||
} | ||
```ts | ||
defineNuxtConfig({ | ||
extends: ['nuxt-umami@next'] | ||
}); | ||
``` | ||
Only `websiteId` and `scriptUrl` are mandatory. [See the Umami docs](https://umami.is/docs/tracker-configuration) for more explanation of these options. | ||
### Step 2: Configure Umami | ||
> **New**: | ||
> Set the `enable` option to `false` to disable the module (temporarily). | ||
You can provide configuration options using the `app.config.ts` file or `appConfig` property of the Nuxt config. | ||
#### `app.config.ts` file | ||
### 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. | ||
(recommended for readability and ease of update) | ||
<br> | ||
## Usage | ||
> **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>` | ||
```vue | ||
<script setup> | ||
const { $umami } = useNuxtApp(); | ||
onMounted(() => { | ||
// Sends an event with an event type of custom. | ||
$umami("Signup button click"); | ||
```ts | ||
export default defineAppConfig({ | ||
umami: { | ||
// ...umami config here | ||
}, | ||
}); | ||
</script> | ||
``` | ||
### In middleware, asyncData, etc | ||
#### `appConfig` property | ||
```javascript | ||
const { data } = await useAsyncData("mountains", (nuxtApp) => { | ||
const { $umami } = nuxtApp(); | ||
// do something, return something | ||
```ts | ||
defineNuxtConfig({ | ||
extends: ['nuxt-umami@next'], | ||
appConfig: { | ||
umami: { | ||
// ...umami config here | ||
}, | ||
}, | ||
}); | ||
``` | ||
## Available Functions | ||
### Step 3: | ||
> For a list of all available functions, see [Umami Tracker Functions](https://umami.is/docs/tracker-functions) | ||
Use it? | ||
## Credits | ||
## Configuration | ||
- [VueUse](https://github.com/vueuse/vueuse) - for `useScriptTag` composable. | ||
- [Joe Pritchard](https://github.com/joe-pritchard/nuxt-umami-module) - author of nuxt-umami-module (compatible only with Nuxt 2). | ||
| option | type | description | required | default | | ||
|---|---|---|---|---| | ||
| host | string | Your Umami endpoint. This is where your script is hosted. Eg: `https://ijkml.xyz/`. | true | '' | | ||
| id | string | Unique website-id provided by Umami. | true | '' | | ||
| domains | string | Limit tracker to specific domains by providing a comma-separated list (without 'http'). Leave blank for all domains. | false | '' | | ||
| ignoreDnt | boolean | Option to ignore browsers' Do Not Track setting. | false | true | | ||
| autoTrack | boolean | Option to automatically track page views. | false | true | | ||
| ignoreLocalhost | boolean | Option to prevent tracking on localhost. | false | false | | ||
## Author | ||
## Usage | ||
Hi, I'm [ML](https://github.com/ijkml/). I'm dedicated to contributing to open source and sharing my insights on [Twitter](https://twitter.com/ijk_ml). 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. | ||
...coming soon. | ||
Using the module in your app? Consider giving it a star 🌟. It'd mean the world to me. | ||
## Contributions | ||
<a href="https://github.com/ijkml/nuxt-umami/graphs/contributors"> | ||
<img src="https://contrib.rocks/image?repo=ijkml/nuxt-umami" /> | ||
</a> | ||
<!-- Banner Image For Reference: https://banner.browserku.com/ --> | ||
<!-- <div | ||
class="relative bg-gradient-to-r from-[#255461] to-[#00DC82] h-full font-open-sans bg-cover bg-center p-2" | ||
> | ||
<div class="z-2 relative bg-white bg-opacity-90 rounded-md shadow-lg h-full p-7 flex flex-col justify-between overflow-hidden"> | ||
<img class="absolute z-1 top-[-80px] right-[-20px] w-[500px] opacity-8" :src="bg"/> | ||
<div> | ||
<h1 class="text-5xl font-bold line-clamp-3 pb-1">{{ title }}</h1> | ||
<p class="text-gray-700 italic">{{ description }}</p> | ||
</div> | ||
<div class="mt-3 flex items-center justify-between"> | ||
<div class="flex items-center space-x-2 text-lg"> | ||
<img class="w-10 h-10 rounded-full" crossorigin="anonymous" :src="avatar" /> | ||
<span class="font-semibold">{{ author }}</span> | ||
</div> | ||
<div> | ||
<img :src="logo" alt="logo" class="h-12" /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> --> | ||
<!-- Format Data --> | ||
<!-- { | ||
"title": "nuxt-umami", | ||
"description": "Umami Analytics built for Nuxt 2/3.", | ||
"author": "Moses Laurence", | ||
"avatar": "https://avatars.githubusercontent.com/u/52390439?v=4", | ||
"bg": "https://nuxtjs.org/design-kit/black-logo.svg", | ||
"logo": "https://nuxtjs.org/design-kit/black-text.svg" | ||
} --> | ||
[MIT](./LICENSE) License © 2023 [ML](https://github.com/ijkml/) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
22536
0
7
19
636
2
103
1
- Removed@nuxt/kit@^3.0.0-rc.13
- Removed@ampproject/remapping@2.3.0(transitive)
- Removed@babel/code-frame@7.26.2(transitive)
- Removed@babel/compat-data@7.26.2(transitive)
- Removed@babel/core@7.26.0(transitive)
- Removed@babel/generator@7.26.2(transitive)
- Removed@babel/helper-compilation-targets@7.25.9(transitive)
- Removed@babel/helper-module-imports@7.25.9(transitive)
- Removed@babel/helper-module-transforms@7.26.0(transitive)
- Removed@babel/helper-string-parser@7.25.9(transitive)
- Removed@babel/helper-validator-identifier@7.25.9(transitive)
- Removed@babel/helper-validator-option@7.25.9(transitive)
- Removed@babel/helpers@7.26.0(transitive)
- Removed@babel/parser@7.26.2(transitive)
- Removed@babel/standalone@7.26.2(transitive)
- Removed@babel/template@7.25.9(transitive)
- Removed@babel/traverse@7.25.9(transitive)
- Removed@babel/types@7.26.0(transitive)
- Removed@jridgewell/gen-mapping@0.3.5(transitive)
- Removed@jridgewell/resolve-uri@3.1.2(transitive)
- Removed@jridgewell/set-array@1.2.1(transitive)
- Removed@jridgewell/sourcemap-codec@1.5.0(transitive)
- Removed@jridgewell/trace-mapping@0.3.25(transitive)
- Removed@nodelib/fs.scandir@2.1.5(transitive)
- Removed@nodelib/fs.stat@2.0.5(transitive)
- Removed@nodelib/fs.walk@1.2.8(transitive)
- Removed@nuxt/kit@3.14.159(transitive)
- Removed@nuxt/schema@3.14.159(transitive)
- Removed@rollup/pluginutils@5.1.3(transitive)
- Removed@sindresorhus/merge-streams@2.3.0(transitive)
- Removed@types/estree@1.0.6(transitive)
- Removedacorn@8.14.0(transitive)
- Removedbraces@3.0.3(transitive)
- Removedbrowserslist@4.24.2(transitive)
- Removedc12@2.0.1(transitive)
- Removedcaniuse-lite@1.0.30001680(transitive)
- Removedchokidar@4.0.1(transitive)
- Removedchownr@2.0.0(transitive)
- Removedcitty@0.1.6(transitive)
- Removedcompatx@0.1.8(transitive)
- Removedconfbox@0.1.8(transitive)
- Removedconsola@3.2.3(transitive)
- Removedconvert-source-map@2.0.0(transitive)
- Removedcross-spawn@7.0.5(transitive)
- Removeddebug@4.3.7(transitive)
- Removeddefu@6.1.4(transitive)
- Removeddestr@2.0.3(transitive)
- Removeddotenv@16.4.5(transitive)
- Removedelectron-to-chromium@1.5.57(transitive)
- Removedescalade@3.2.0(transitive)
- Removedescape-string-regexp@5.0.0(transitive)
- Removedestree-walker@2.0.23.0.3(transitive)
- Removedexeca@8.0.1(transitive)
- Removedfast-glob@3.3.2(transitive)
- Removedfastq@1.17.1(transitive)
- Removedfill-range@7.1.1(transitive)
- Removedfs-minipass@2.1.0(transitive)
- Removedgensync@1.0.0-beta.2(transitive)
- Removedget-stream@8.0.1(transitive)
- Removedgiget@1.2.3(transitive)
- Removedglob-parent@5.1.2(transitive)
- Removedglobals@11.12.0(transitive)
- Removedglobby@14.0.2(transitive)
- Removedhash-sum@2.0.0(transitive)
- Removedhookable@5.5.3(transitive)
- Removedhuman-signals@5.0.0(transitive)
- Removedignore@5.3.26.0.2(transitive)
- Removedis-extglob@2.1.1(transitive)
- Removedis-glob@4.0.3(transitive)
- Removedis-number@7.0.0(transitive)
- Removedis-stream@3.0.0(transitive)
- Removedisexe@2.0.0(transitive)
- Removedjiti@2.4.0(transitive)
- Removedjs-tokens@4.0.09.0.0(transitive)
- Removedjsesc@3.0.2(transitive)
- Removedjson5@2.2.3(transitive)
- Removedklona@2.0.6(transitive)
- Removedknitwork@1.1.0(transitive)
- Removedlocal-pkg@0.5.0(transitive)
- Removedlru-cache@5.1.1(transitive)
- Removedmagic-string@0.30.12(transitive)
- Removedmerge-stream@2.0.0(transitive)
- Removedmerge2@1.4.1(transitive)
- Removedmicromatch@4.0.8(transitive)
- Removedmimic-fn@4.0.0(transitive)
- Removedminipass@3.3.65.0.0(transitive)
- Removedminizlib@2.1.2(transitive)
- Removedmkdirp@1.0.4(transitive)
- Removedmlly@1.7.3(transitive)
- Removedmri@1.2.0(transitive)
- Removedms@2.1.3(transitive)
- Removednode-fetch-native@1.6.4(transitive)
- Removednode-releases@2.0.18(transitive)
- Removednpm-run-path@5.3.0(transitive)
- Removednypm@0.3.12(transitive)
- Removedohash@1.1.4(transitive)
- Removedonetime@6.0.0(transitive)
- Removedpath-key@3.1.14.0.0(transitive)
- Removedpath-type@5.0.0(transitive)
- Removedpathe@1.1.2(transitive)
- Removedperfect-debounce@1.0.0(transitive)
- Removedpicocolors@1.1.1(transitive)
- Removedpicomatch@2.3.14.0.2(transitive)
- Removedpkg-types@1.2.1(transitive)
- Removedqueue-microtask@1.2.3(transitive)
- Removedrc9@2.1.2(transitive)
- Removedreaddirp@4.0.2(transitive)
- Removedreusify@1.0.4(transitive)
- Removedrun-parallel@1.2.0(transitive)
- Removedscule@1.3.0(transitive)
- Removedsemver@6.3.17.6.3(transitive)
- Removedshebang-command@2.0.0(transitive)
- Removedshebang-regex@3.0.0(transitive)
- Removedsignal-exit@4.1.0(transitive)
- Removedslash@5.1.0(transitive)
- Removedstd-env@3.8.0(transitive)
- Removedstrip-final-newline@3.0.0(transitive)
- Removedstrip-literal@2.1.0(transitive)
- Removedtar@6.2.1(transitive)
- Removedto-regex-range@5.0.1(transitive)
- Removedufo@1.5.4(transitive)
- Removeduncrypto@0.1.3(transitive)
- Removedunctx@2.3.1(transitive)
- Removedunicorn-magic@0.1.0(transitive)
- Removedunimport@3.13.1(transitive)
- Removedunplugin@1.15.0(transitive)
- Removeduntyped@1.5.1(transitive)
- Removedupdate-browserslist-db@1.1.1(transitive)
- Removedwebpack-virtual-modules@0.6.2(transitive)
- Removedwhich@2.0.2(transitive)
- Removedyallist@3.1.14.0.0(transitive)