unjs / website

UnJS website Content and Design!
https://unjs.io
Other
131 stars 25 forks source link

chore: manually track page view #250

Closed Barbapapazes closed 9 months ago

Barbapapazes commented 9 months ago

๐Ÿ”— Linked issue

โ“ Type of change

๐Ÿ“š Description

Manually track page view to avoid to many request when use URL as state of the application.

๐Ÿ“ Checklist

pi0 commented 9 months ago

I think this should have been an option in upstream module.

Barbapapazes commented 9 months ago

I think this should have been an option in upstream module.

Yes but no commit since 2 years. So doing a proposal for this will have no end actually.

https://github.com/plausible/plausible-tracker/issues/61

pi0 commented 9 months ago

Then we might consider replacing it. /cc @Atinux

atinux commented 9 months ago

I think we should update the module instead.

Not sure about this issue though of the query parameters as it can be useful to track too since it is a different state.

pi0 commented 9 months ago

If we update and maintain module i think perhaps we can introduce a new page meta to disable tracking query params when it is not wanted it seems a valid requirement IMO for pages that use query as state holder and only need tracking for main URLs.

Barbapapazes commented 9 months ago

I think we should update the module instead.

Not sure about this issue though of the query parameters as it can be useful to track too since it is a different state.

The issue of tracking every state of the URL is that for an query input, every type will be pushed to plausible (could cause a lot of input so increase the price of the service?). I prefer to manually send some params over time, like https://github.com/nuxt/nuxt.com/blob/main/app.vue#L37

atinux commented 9 months ago

I did not see at first it was for this website. Since it's a special once, I am fine for special usage here.

Barbapapazes commented 9 months ago

Not sure about this issue though of the query parameters as it can be useful to track too since it is a different state.

Plausible will remove query parameters so this will only send page event. (see https://plausible.io/docs/custom-query-params)

If we update and maintain module i think perhaps we can introduce a new page meta to disable tracking query params when it is not wanted it seems a valid requirement IMO for pages that use query as state holder and only need tracking for main URLs.

I made a fork: https://github.com/barbapapazes/plausible-tracker. It will be release within the next version of Nuxt Plausible module. Maybe we could try to make something smarter.