vue-plausible
vue-plausible copied to clipboard
Nuxt 3 Support
Hi,
Is this plugin compatible with Nuxt 3?
Thank you
Doesn't seem to work atm, it doesn't send any data...
Thanks for filing the issue! Nuxt 3 as well as Vue 3 support is a priority but unfortunately I won't have time to work on this until mid February. I'll update you as soon as I know more.
Update:
It actually seems to work. Forgot to set the domain in settings...
You just have to add the module and set the domain in "plausible" settings:
// nuxt.config.ts
modules: [
'vue-plausible',
],
plausible: {
domain: 'my-domain.com',
},
Disclaimer:
Haven't tested if all events are fired correctly, but at first glance it looks good.
Update:
The module creates problems with <a>
tags, see comment below.
I can confirm it works with Nuxt 3 😊
Having an issue on Nuxt 3 where my modals open then refresh the page as soon as I install this module. When I remove the module everything works as normal.
@IzakJackson you are right, I have a similar problem with <a>
tags. Until I saw your comment I didn't realize it was caused by the Plausible module. As soon as I enable the module <a>
tags behave weird, target="_blank"
doesn't work, all links always open in the current tab and when using an <a>
tag without href
, e.g. as a button, clicking on it will refresh the page.
@toniengelhardt Yeah, it was on an <a>
tag that I was having this issue actually.
@IzakJackson as a temporary workaround you can use <div>
s instead of anchors.
@IzakJackson you are right, I have a similar problem with
<a>
tags. Until I saw your comment I didn't realize it was caused by the Plausible module. As soon as I enable the module<a>
tags behave weird,target="_blank"
doesn't work, all links always open in the current tab and when using an<a>
tag withouthref
, e.g. as a button, clicking on it will refresh the page.
I've encountered the same problem, but found that disabling enableOutboundTracking
fixed the target="_blank"
problem. Not a great solution though...
Thanks @bmhtech07, you're right, disabling outbound tracking resolves the problem!
ERROR [vite]: Rollup failed to resolve import "plausible-tracker" from "virtual:nuxt:/home/productdevbook/Documents/GitHub/vucod/bb/.nuxt/vue-plausible.client.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
omg I was wondering why my "_blank" links weren't working! same issue here, disabling enableOutboundTracking fixes it but would love to have both blank & outbound tracking!
module does work with with nuxt3 rc 11, BUT console shows errors (below), anything we can do to silence these ?
warn] [nuxt] You are using a plugin with legacy Nuxt 2 format (context, inject) which is likely to be broken. In the future they will be ignored: PlausiblePlugin
Plugin not working with Nuxt3 Stable 3.0.0
Cannot read properties of undefined (reading 'options') 23:39:55
at PlausibleModule (node_modules/vue-plausible/lib/cjs/nuxt-module.js:18:89)
at installModule (node_modules/@nuxt/kit/dist/index.mjs:416:9)
at async initNuxt (node_modules/nuxt/dist/index.mjs:1825:7)
at async loadNuxt (node_modules/nuxt/dist/index.mjs:1857:5)
at async loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:493:19)
at async Object.invoke (node_modules/nuxi/dist/chunks/build.mjs:34:18)
at async _main (node_modules/nuxi/dist/cli.mjs:50:20)
Options were set in nuxt.config.ts It Stopped working after upgrading from RC11 to 3.0.0