nuxt / scripts

Third-Party Scripts Meets Nuxt Developer Experience.
https://scripts.nuxt.com
MIT License
273 stars 31 forks source link

apiHost option for plausible #104

Closed dev-cetus closed 2 months ago

dev-cetus commented 3 months ago

For plausible, you'd have to add an apiHost option, as @nuxtjs/plausible does, because plausible can also be installed in self-hosted mode.

harlan-zw commented 2 months ago

The API host is by default where the script is being loaded from when using the third-party script. The @nuxtjs/plausible module uses the NPM module instead which can't infer the domain, hence why the apiHost config exists.

You can change the src of the like the below, which will change the API host to my-self-hosted-plausible.io.

useScriptPlausible({
  scriptInput: {
    src: 'https://my-self-hosted-plausible.io/js/script.js'
  }
})

I've added a note for this in the docs but let me know if it's not clear.

dev-cetus commented 1 month ago

Okay just one question, it changes for js/script.js, but will it also change for event sending (it seems to me that it's a different script)?