Plausible Not Working in Next.js (next-plausible)

Workaround available Web (Next.js) Updated October 21, 2026

Quick answer

next-plausible usually fails because the proxy config doesn't match the provider, the site is statically exported (rewrites don't run), or events are sent from a server component. Match src in PlausibleProvider and withPlausibleProxy and call usePlausible from a client component.

Most likely fix: Match the proxy and provider config.

Symptoms

No pageviews after deploying a Next.js site, proxied /js/script.js returns 404, or custom events from usePlausible never arrive. Some users report breakage after Next.js upgrades.

Why it happens

  • Proxy rewrites don't work with static export (they need next start or a platform that runs rewrites)
  • withPlausibleProxy config doesn't match PlausibleProvider (v4 requires the same src in both)
  • Self-hosted Plausible without customDomain set
  • usePlausible called outside a 'use client' component
  • Testing on localhost, where tracking is disabled by default

How to fix it

Try these in order — the most common fix is first.

  1. 1. Match the proxy and provider config

    1. Wrap next.config with withPlausibleProxy
    2. In next-plausible v4, pass the same script src to withPlausibleProxy as to PlausibleProvider
    3. Rebuild and check that /js/script.js and /api/event load from your domain
  2. 2. Don't rely on rewrites with static export

    1. If you use output: 'export', load the script directly from plausible.io or set up a proxy at your CDN (Cloudflare, Netlify, Vercel)
    2. Otherwise deploy with next start or Vercel so rewrites run
  3. 3. Fix custom events in the App Router

    1. Move usePlausible calls into a component marked 'use client'
    2. Make sure PlausibleProvider wraps the layout
    3. Create a matching goal in Site settings > Goals
  4. 4. Self-hosted instance

    1. Set customDomain to your Plausible CE URL
    2. Check the Network tab that requests go to your instance

This guide also covers

  • next-plausible not working
  • plausible nextjs
  • plausible next.js app router
  • withPlausibleProxy not working

Still not working?

If Plausible Analytics keeps failing, you're not alone. See every Plausible Analytics problem users report or the alternatives people switch to.

Other Plausible Analytics errors