Skip to content

Plausible's new script not working #543

Description

@hymair

🐛 The bug

The changes done in #534 do not seem to work for us.

We see the elements added in the DOM with the correct script IDs, but no events are sent.

Our setup is basic:

export default defineNuxtConfig({
scripts: {
registry: {
plausibleAnalytics: {
scriptId: process.env.PLAUSIBLE_SCRIPT_ID!,
},
},
},
})

Here are the elements added to the DOM:

1. link in head

<linkhref="https://plausible.io/js/pa-CORRECT_SCRIPT_ID.js" rel="preload" crossorigin="anonymous" referrerpolicy="no-referrer" fetchpriority="low" as="script">

2. script in head:

<scriptdefer="" fetchpriority="low" crossorigin="anonymous" referrerpolicy="no-referrer" src="https://plausible.io/js/pa-CORRECT_SCRIPT_ID.js" data-onload="" data-onerror="" data-hid="plausibleAnalytics"></script>

3. nuxt context at end of body (relevant parts only):

{
"public": {
"nuxt-scripts": {
"version": "",
"defaultScriptOptions": { "trigger": "onNuxtReady" }
},
"scripts": {
"plausibleAnalytics": { "scriptId": "CORRECT_SCRIPT_ID" }
}
}
}

🛠️ To reproduce

https://stackblitz.com/edit/nuxt-starter-pkwfkx?file=pages%2Findex.vue

🌈 Expected behavior

No repro, as I don't really know how to repro this without a plausible account and all.

We expect events to be logged. We were using @nuxtjs/plausible before (no script ids) and it worked fine.

ℹ️ Additional context

Plausible dashboard couldn't detect the installation either:

Image

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