@nuxtjs/plausible
Advanced tools
Comparing version 0.2.4 to 1.0.0
@@ -5,6 +5,12 @@ import * as _nuxt_schema from '@nuxt/schema'; | ||
/** | ||
* Whether page views shall be tracked when the URL hash changes | ||
* Whether the tracker shall be enabled. | ||
* | ||
* @default true | ||
*/ | ||
enabled?: boolean; | ||
/** | ||
* Whether page views shall be tracked when the URL hash changes. | ||
* | ||
* @remarks | ||
* Enable this if your Nuxt app has the `hashMode` router option enabled | ||
* Enable this if your Nuxt app has the `hashMode` router option enabled. | ||
* | ||
@@ -15,4 +21,5 @@ * @default false | ||
/** | ||
* Whether events shall be tracked when running the site locally | ||
* Whether events shall be tracked when running the site locally. | ||
* | ||
* @deprecated Please use `ignoredHostnames` instead. | ||
* @default false | ||
@@ -22,4 +29,10 @@ */ | ||
/** | ||
* The domain to bind tracking event to | ||
* Hostnames to ignore when tracking events. | ||
* | ||
* @default ['localhost'] | ||
*/ | ||
ignoredHostnames?: string[]; | ||
/** | ||
* The domain to bind tracking event to. | ||
* | ||
* @default window.location.hostname | ||
@@ -29,3 +42,3 @@ */ | ||
/** | ||
* The API host where the events will be sent to | ||
* The API host where the events will be sent to. | ||
* | ||
@@ -36,6 +49,6 @@ * @default 'https://plausible.io' | ||
/** | ||
* Track the current page and all further pages automatically | ||
* Track the current page and all further pages automatically. | ||
* | ||
* @remarks | ||
* Disable this if you want to manually manage pageview tracking | ||
* Disable this if you want to manually manage pageview tracking. | ||
* | ||
@@ -46,6 +59,6 @@ * @default true | ||
/** | ||
* Track all outbound link clicks automatically | ||
* Track all outbound link clicks automatically. | ||
* | ||
* @remarks | ||
* If enabled, a [MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) automagically detects link nodes throughout the application and binds `click` events to them | ||
* If enabled, a [MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) automagically detects link nodes throughout the application and binds `click` events to them. | ||
* | ||
@@ -55,2 +68,8 @@ * @default false | ||
autoOutboundTracking?: boolean; | ||
/** | ||
* Log events to the console if they are ignored. | ||
* | ||
* @default false | ||
*/ | ||
logIgnoredEvents?: boolean; | ||
} | ||
@@ -57,0 +76,0 @@ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>; |
{ | ||
"name": "@nuxtjs/plausible", | ||
"version": "0.2.4", | ||
"version": "1.0.0", | ||
"configKey": "plausible", | ||
"compatibility": { | ||
"nuxt": "^3" | ||
"nuxt": "^3.7" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import type Plausible from 'plausible-tracker'; | ||
import type { EventName, EventOptions } from '@barbapapazes/plausible-tracker'; | ||
/** | ||
@@ -6,3 +6,3 @@ * Tracks a custom event | ||
* @remarks | ||
* Track your defined goals by passing the goal's name as the argument `eventName` | ||
* Track your defined goals by passing the goal's name as the argument `eventName`. | ||
* | ||
@@ -16,2 +16,2 @@ * @example | ||
*/ | ||
export declare function useTrackEvent(...args: Parameters<ReturnType<typeof Plausible>['trackEvent']>): void; | ||
export declare function useTrackEvent(eventName: EventName, options?: EventOptions): void; |
@@ -1,2 +0,2 @@ | ||
import type Plausible from 'plausible-tracker'; | ||
import type { EventOptions } from '@barbapapazes/plausible-tracker'; | ||
/** | ||
@@ -11,2 +11,2 @@ * Manually track a page view | ||
*/ | ||
export declare function useTrackPageview(...args: Parameters<ReturnType<typeof Plausible>['trackPageview']>): void; | ||
export declare function useTrackPageview(options?: EventOptions): void; |
{ | ||
"name": "@nuxtjs/plausible", | ||
"type": "module", | ||
"version": "0.2.4", | ||
"packageManager": "pnpm@8.11.0", | ||
"description": "Nuxt 3 module to natively integrate Plausible analytics", | ||
"version": "1.0.0", | ||
"packageManager": "pnpm@8.15.6", | ||
"description": "Natively integrates Plausible Analytics into Nuxt", | ||
"author": "Johann Schopplich <pkg@johannschopplich.com>", | ||
@@ -16,6 +16,6 @@ "license": "MIT", | ||
"keywords": [ | ||
"analytics", | ||
"nuxt", | ||
"nuxt3", | ||
"plausible", | ||
"analytics" | ||
"plausible" | ||
], | ||
@@ -39,4 +39,4 @@ "exports": { | ||
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground", | ||
"lint": "eslint . --ignore-path .gitignore", | ||
"lint:fix": "eslint . --fix --ignore-path .gitignore", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix", | ||
"test:types": "tsc --noEmit", | ||
@@ -48,21 +48,19 @@ "format": "prettier \"**/*.{css,html,json,md,mjs,ts,vue,yml}\" --write", | ||
"dependencies": { | ||
"@nuxt/kit": "^3.8.2", | ||
"defu": "^6.1.3", | ||
"pathe": "^1.1.1", | ||
"plausible-tracker": "^0.3.8" | ||
"@barbapapazes/plausible-tracker": "^0.4.0", | ||
"@nuxt/kit": "^3.11.1", | ||
"defu": "^6.1.4" | ||
}, | ||
"devDependencies": { | ||
"@nuxt/eslint-config": "^0.2.0", | ||
"@nuxt/module-builder": "^0.5.4", | ||
"@nuxt/schema": "^3.8.2", | ||
"@nuxtjs/plausible": "workspace:*", | ||
"@types/node": "^20.10.3", | ||
"bumpp": "^9.2.0", | ||
"eslint": "^8.55.0", | ||
"@nuxt/eslint-config": "0.3.0-beta.9", | ||
"@nuxt/module-builder": "^0.5.5", | ||
"@nuxt/schema": "^3.11.1", | ||
"@types/node": "^20.12.3", | ||
"bumpp": "^9.4.0", | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"nuxt": "^3.8.2", | ||
"prettier": "^3.1.0", | ||
"typescript": "^5.3.2", | ||
"vue-tsc": "^1.8.24" | ||
"nuxt": "^3.11.1", | ||
"prettier": "^3.2.5", | ||
"typescript": "^5.4.3", | ||
"vue-tsc": "^2.0.7" | ||
} | ||
} |
@@ -7,3 +7,3 @@ ![Nuxt Plausible module](./.github/og.png) | ||
[Nuxt 3](https://nuxt.com) module to integrate the [Plausible tracker](https://github.com/plausible/plausible-tracker). | ||
Native integration of [Plausible Analytics](https://plausible.io/sites) for [Nuxt](https://nuxt.com). | ||
@@ -21,7 +21,3 @@ ## Features | ||
```bash | ||
# pnpm | ||
pnpm add -D @nuxtjs/plausible | ||
# npm | ||
npm i -D @nuxtjs/plausible | ||
npx nuxi@latest module add plausible | ||
``` | ||
@@ -43,3 +39,3 @@ | ||
> [!TIP] | ||
> By default, `@nuxtjs/plausible` will use `window.location.hostname` for the Plausible `domain` configuration key, which will suit most users. | ||
> By default, `@nuxtjs/plausible` will use `window.location.hostname` for the Plausible `domain` configuration key, which should suit most use-cases. If you need to customize the domain, you can do so in the [module options](#module-options). | ||
@@ -55,3 +51,4 @@ ## Configuration | ||
plausible: { | ||
domain: 'example.com', | ||
// Prevent tracking on localhost | ||
ignoredHostnames: ['localhost'], | ||
}, | ||
@@ -74,16 +71,19 @@ }) | ||
| Option | Type | Default | Description | | ||
| ---------------------- | --------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `hashMode` | `boolean` | `false` | Whether page views shall be tracked when the URL hash changes. Enable this if your Nuxt app has the `hashMode` router option enabled. | | ||
| `trackLocalhost` | `boolean` | `false` | Whether events shall be tracked when running the site locally. | | ||
| `domain` | `string` | `'window.location.hostname'` | The domain to bind tracking event to. | | ||
| `apiHost` | `string` | `https://plausible.io` | The API host where the events will be sent to. | | ||
| `autoPageviews` | `boolean` | `true` | Track the current page and all further pages automatically. Disable this if you want to manually manage pageview tracking. | | ||
| `autoOutboundTracking` | `boolean` | `false` | Track all outbound link clicks automatically. If enabled, a [MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) automagically detects link nodes throughout the application and binds `click` events to them. | | ||
| Option | Type | Default | Description | | ||
| ---------------------- | ---------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `enabled` | `boolean` | `true` | Whether the tracker shall be enabled. | | ||
| `hashMode` | `boolean` | `false` | Whether page views shall be tracked when the URL hash changes. Enable this if your Nuxt app uses the `hashMode` router option instead of the default history mode. | | ||
| `domain` | `string` | `'window.location.hostname'` | The domain to bind tracking event to. | | ||
| `ignoredHostnames` | `string[]` | `['localhost']` | Hostnames to ignore when tracking events. | | ||
| `apiHost` | `string` | `https://plausible.io` | The API host where the events will be sent to. | | ||
| `autoPageviews` | `boolean` | `true` | Track the current page and all further pages automatically. Disable this if you want to manually manage pageview tracking. | | ||
| `autoOutboundTracking` | `boolean` | `false` | Track all outbound link clicks automatically. If enabled, a [MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) automagically detects link nodes throughout the application and binds `click` events to them. | | ||
| `logIgnoredEvents` | `boolean` | `false` | Log events to the console if they are ignored. | | ||
## Composables | ||
As with other composables in the Nuxt 3 ecosystem, they are auto-imported and can be used in your application's components. | ||
As with other composables in the Nuxt ecosystem, they are auto-imported and can be used in your application's components. | ||
> ℹ️ Since the Plausible instance is available in the client only, executing the composables on the server will have no effect. | ||
> [!NOTE] | ||
> Since the Plausible instance is available in the client only, executing the composables on the server will have no effect. | ||
@@ -137,8 +137,8 @@ ### `useTrackEvent` | ||
## Similar Packages | ||
## Credits | ||
- [vue-plausible](https://github.com/moritzsternemann/vue-plausible), without first-class Nuxt 3 and composables. | ||
- [@Barbapapazes](https://github.com/Barbapapazes) for his [Plausible tracker rewrite](https://github.com/Barbapapazes/plausible-tracker) | ||
## License | ||
[MIT](./LICENSE) License © 2022-2023 [Johann Schopplich](https://github.com/johannschopplich) | ||
[MIT](./LICENSE) License © 2022-PRESENT [Johann Schopplich](https://github.com/johannschopplich) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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 v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
19431
3
11
20
251
0
+ Added@barbapapazes/plausible-tracker@0.4.0(transitive)
- Removedpathe@^1.1.1
- Removedplausible-tracker@^0.3.8
- Removedplausible-tracker@0.3.9(transitive)
Updated@nuxt/kit@^3.11.1
Updateddefu@^6.1.4