Skip to content

self-hosted plausible cannot be used #768

Description

@jrutila

🐛 The bug

According to the documentation, one should be able to use self-hosted plausible with plausibleAnalytics script: https://scripts.nuxt.com/scripts/plausible-analytics#self-hosted-plausible.

I sucessfully had my self-hosted plausible working in version 0.13.2. But with 1.0.6 I think the feature is broken.

Looking at the code of the plausibleAnalytics script (

if(useNewScript){
// New October 2025 format with unique script ID
scriptSrc=`https://plausible.io/js/pa-${options.scriptId}.js`
}
elseif(useLegacyScript){
// Legacy extension format
constextensions=Array.isArray(options.extension) ? options.extension.join('.') : [options.extension]
scriptSrc=`https://plausible.io/js/script.${extensions}.js`
}
else{
// Legacy basic script
scriptSrc='https://plausible.io/js/script.js'
}
), it doesn't really override the default plausible.io src at any point.

I think "the magic" happens later, but am I using the scriptInput.src wrong now?

Event setting proxy: false does not seem to help, as the frontend still tries to load it from plausible.io. It removes the build time error, still.

🛠️ To reproduce

https://stackblitz.com/edit/nuxt-starter-sapvn3tf?file=nuxt.config.ts

🌈 Expected behavior

Without the self-hosted url, the reproduction should fail on this error:

ℹ Error: virtual:nuxt:%2Fhome%2Fprojects%2Fnuxt-starter-pkwfkx%2F.nuxt%2Fmodules%2F%40nuxt-scripts%2Fplugin.mjs — "https://plausible.io/js/pa-non-existing.js": <no response> fetch failed

When adding the commented out scriptInput.src (as instructed in doc) to nuxt.config.ts it should fail while trying the my-self-hosted-plausible.io instead of plausible.io.

RESULT:

ℹ Error: virtual:nuxt:%2Fhome%2Fprojects%2Fnuxt-starter-pkwfkx%2F.nuxt%2Fmodules%2F%40nuxt-scripts%2Fplugin.mjs — "https://plausible.io/js/pa-non-existing.js": <no response> fetch failed

EXPECTED RESULT:

ℹ Error: virtual:nuxt:%2Fhome%2Fprojects%2Fnuxt-starter-pkwfkx%2F.nuxt%2Fmodules%2F%40nuxt-scripts%2Fplugin.mjs — "https://my-self-hosted-plausible.io/js/pa-non-existing.js": <no response> fetch failed

ℹ️ Additional context

Nuxt project info:
| | |
| -------------------- | --------------------------------------------------------------------------------------------------------------- |
| **Operating system** | `Linux 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36` |
| **CPU** | `Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (8 cores)` |
| **Node.js version** | `v22.22.0` |
| **nuxt/cli version** | `3.35.2` |
| **Package manager** | `pnpm@8.15.6` |
| **Nuxt version** | `4.4.5` |
| **Nitro version** | `2.13.4` |
| **Builder** | `vite@7.3.3` |
| **Config** | `compatibilityDate`, `modules`, `runtimeConfig`, `scripts` |
| **Modules** | `@nuxt/scripts@1.0.6` |

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions