About this project
Nuxt Plausible is a lightweight module that integrates the Plausible analytics service into Nuxt applications. Installation is a single command (`npx nuxt module add plausible`) and adding `@nuxtjs/plausible` to the `modules` array in `nuxt.config.ts` enables tracking without further configuration. By default the module uses the current hostname as the Plausible domain, but the `domain` option can override this.
Key features include:
- Automatic page‑view tracking, with optional hash‑mode support.
- Built‑in tracking of outbound link clicks, file downloads and form submissions, configurable via `autoOutboundTracking`, `fileDownloads`, and `formSubmissions` options.
- Manual tracking through auto‑imported composables `useTrackEvent` and `useTrackPageview` for custom goals and virtual page views.
- Optional proxy (`proxy: true`) that routes events through the Nuxt server (`/_plausible/api/event`), helping bypass ad‑blockers while keeping cookies on your own origin.
- Runtime configuration via public environment variables (e.g., `NUXT_PUBLIC_PLAUSIBLE_DOMAIN`) for easy deployment across environments.
- SSR‑ready implementation, ensuring no client‑only code leaks into server bundles.
Configuration is done either in the `plausible` key of `nuxt.config.ts` or through `.env` variables. Common options include `enabled`, `ignoredHostnames`, `ignoreSubDomains`, `apiHost`, `autoPageviews`, `logIgnoredEvents`, and proxy settings such as `proxyBaseEndpoint`.
The module respects privacy by sending only minimal headers (user‑agent, content‑type, x‑forwarded‑for) to Plausible and by allowing you to disable tracking entirely with `enabled: false`. All features are documented in the README with usage examples.
Development follows standard Nuxt module conventions: clone the repo, enable Corepack, install dependencies with pnpm, run `pnpm run dev:prepare`, and start the dev server with `pnpm run dev`. The project is licensed under the MIT license.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.