next-plausible

Drop-in Plausible Analytics integration for Next.js apps

Library
npm
v4.0.0
709 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
35 /100 Needs Attention
Development Activity 4
Maintenance 0
Community 48
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
69 /100 Good
Architecture 65
Code Quality 68
Innovation 62
Learning Curve 82

next-plausible wires Plausible Analytics into a Next.js application with minimal setup: a PlausibleProvider component injects the tracking script at the app or page level, and a withPlausibleProxy config wrapper rewrites the script and API endpoint through your own domain to reduce ad-blocker interference. It supports the Pages Router, the App Router, and both server-rendered and statically generated sites.

Beyond pageview tracking, the package exposes a usePlausible hook for firing custom events from client components, with optional TypeScript generics to type-check event names and their properties at compile time.

What You Get

  • A PlausibleProvider component for injecting the Plausible script in _app, a page, or the App Router root layout
  • A withPlausibleProxy Next.js config wrapper that proxies the script and event API through your own domain
  • A usePlausible hook for sending custom events, with optional generic typing of event names and properties
  • Support for Plausible init options like custom properties, file-download tracking, and hash-based routing
  • Configurable proxy paths and script props for advanced deployment setups

Common Use Cases

  • Adding privacy-friendly, cookie-free analytics to a Next.js marketing site or app
  • Proxying the analytics script through a first-party path to avoid ad-blocker false positives
  • Tracking custom conversion events (signups, button clicks) from client components with type-checked event names
  • Migrating a Next.js site from Google Analytics to a lighter, GDPR-friendly alternative

Under The Hood

Architecture - The package is a thin adapter split across three files: lib/PlausibleProvider.tsx renders the Plausible script tag and reads environment context to decide whether tracking is enabled, lib/usePlausible.ts exposes a hook that reads the injected window.plausible function, and lib/withPlausibleProxy.ts wraps a Next.js config object to add rewrites for the proxied script and API paths. Tech Stack - Written in TypeScript, built with tsc plus Rollup into CJS/ESM/type-declaration bundles, tested with Jest and Testing Library across a matrix of proxy configurations (custom domain, base path, trailing slash, App Router) under the test/ directory. Code Quality - The core logic is intentionally small (about 240 lines across the three lib files) with an extensive integration test suite covering proxy edge cases (locale, cookies, sub-paths), though the core provider/hook files themselves have no dedicated unit tests beyond the proxy fixtures. API Design - The public API is minimal and idiomatic React/Next.js: a provider component, one hook, and one config-wrapping function, with TypeScript generics available to type custom event props, keeping the learning curve low for anyone already familiar with Next.js conventions.

Used by 8 apps in this directory

TypeScript
76%
AGPL 3.0

Abby

Developer Tools · Product Management

166

Statically typed feature flags, remote config, and A/B testing with framework-native SDKs for TypeScript teams.

View details
31
Repo Health
70
Technical
64
Dependency
Built with
TypeScript 76%
MDX 18%
Updated 1 years ago
TypeScript
89%
MIT

Amical

AI Assistants · Note Taking · Voice AI

1,540

Local-first AI dictation that understands your active app — private, offline, and built for speed.

View details
82
Repo Health
82
Technical
68
Dependency
Built with
TypeScript 89%
Updated 1 weeks ago
TypeScript
92%
AGPL 3.0

Documenso

Digital Signiture

15,224

Self-hosted, open-source DocuSign alternative with legally binding PDF signatures, multi-party workflows, and a full REST and tRPC API.

View details
93
Repo Health
79
Technical
68
Dependency
Built with
TypeScript 92%
Updated 4 days ago
TypeScript
100%
Other

Dub

Analytics · Marketing

24,835

The open-source link attribution platform for short links, conversion tracking, and affiliate programs — powering 100M+ clicks monthly.

View details
81
Repo Health
78
Technical
62
Dependency
Built with
TypeScript 100%
Updated 4 days ago
Python
70%
Apache 2.0

GPT Researcher

AI Assistants · Productivity

29,650

The pioneering open-source autonomous AI agent that conducts deep, multi-source research and produces citation-backed reports exceeding 2,000 words — faster and more reliably than any human researcher.

View details
91
Repo Health
91
Technical
63
Dependency
Built with
Python 70%
TypeScript 18%
Updated 6 days ago
TypeScript
100%
MIT

Llama Coder

AI Development · Low Code Platforms

7,135

Generate multi-file web apps from a single prompt using open-source LLMs — an open-source alternative to Claude Artifacts.

View details
71
Repo Health
66
Technical
69
Dependency
Built with
TypeScript 100%
Updated 2 weeks ago
TypeScript
82%
AGPL 3.0

OpenStatus

Devops · Monitoring

9,143

Open-source status pages and uptime monitoring with global synthetic checks, monitoring-as-code, and AI agent integration via MCP.

View details
77
Repo Health
82
Technical
69
Dependency
Built with
TypeScript 82%
MDX 15%
Updated 5 days ago
TypeScript
80%
AGPL 3.0

Postiz

Automation · Social Media

36,421

The agentic social media scheduler — AI-powered content creation, 33-platform posting, and team workflows, all self-hosted.

View details
91
Repo Health
70
Technical
63
Dependency
Built with
TypeScript 80%
JavaScript 11%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers