ihucos / counter.dev

Web Analytics made simple
https://counter.dev
GNU Affero General Public License v3.0
900 stars 40 forks source link

How to correctly implement Counter.dev in a Vue.js Single Page Application? #120

Open saeedesmaili opened 1 year ago

saeedesmaili commented 1 year ago

I want to use Counter.dev to track page views on my Vue.js Single Page app. I've noticed that the current implementation of the tracking script doesn't correctly track page views when navigating between pages using components.

Could you please provide some guidance on how to correctly implement Counter.dev in a Vue.js SPA to ensure accurate page view tracking when the route changes?

I have added the tracking script to public/index.html's <head> section, and the counter is only counting the first page each user visits.

Thank you for your help and for developing Counter.dev

ihucos commented 1 year ago

Hello!

great question. I would like to support and properly document how to do this. As an old-school backend developer Single Page applications are magic to me. There is something called pushState that could make such an integration plug and play? I have to confess that I would like to support SPA but lack the knowledge to do it properly.

Cheers