nuxt-modules / plausible

🎟️ Plausible Analytics integration for Nuxt
https://plausible.io
MIT License
102 stars 5 forks source link

Vercel proxy counts every click as unique user #6

Closed appinteractive closed 5 months ago

appinteractive commented 1 year ago

When using this module and proxy the requests like advised in the documentation of plausible, it counts users x times as unique.

my configs:

plausible: {
    apiHost: "",
    trackLocalhost: false,
    autoOutboundTracking: false,
},
"rewrites": [
    {
      "source": "/js/script.js",
      "destination": "https://analytics.mydomain.de/js/plausible.js"
    },
    {
      "source": "/api/event",
      "destination": "https://analytics.mydomain.de/api/event"
    }
]
madebyfabian commented 10 months ago

Hi there, I managed to setup a working proxy, where multiple clicks are still recognized as only one user. The documentation is misleading.

vercel.json:

{
  "rewrites": [
    {
      "source": "/js/script.js",
      "destination": "https://plausible.io/js/script.js"
    },
    {
      "source": "/api/event",
      "destination": "https://plausible.io/api/event"
    }
  ]
}

nuxt.config.ts:

plausible: {
  // Must be the same as the url your vercel deployment is hosted.
  apiHost: 'https://mywebsite.com',
},

Maybe this helps.

appinteractive commented 10 months ago

Hey @madebyfabian thanks for your input.

As far as I can see, it's the exact setup I use currently, only that I use an empty string for the domain, and this should result in the usage of the current domain.

Maybe the current version of Plausible fixed that issue silently, I will have to upgrade anyway and re-test it.

Thanks 👍

johannschopplich commented 5 months ago

Is this issue still relevant?

Closing this, as the issue seems to be related to a provider, not this module itself.