Sorry, we don't support your browser.  Install a modern browser

Support client-side routing (for SPAs)#141

It would be awesome if Plausible supported tracking client-driven routing for my single-page application.

Right now it only seems to track the root (/) URL, which is fine for general traffic, but it would be nice if Plausible was able to track when a user was at /#/about (or something like that).

7 months ago
1

Hey,

Plausible does automatically trigger pageviews based on pushState and popState events. What is missing however is support for hash-based routing.

My guess is that new pageviews are triggered each time you navigate on your site. Just they all get counted as / because we don’t consider the hash part of the url as being part of the pathname. Can you confirm by navigating around and seeing if pageviews are triggered in the network tab?

7 months ago
1

So I can confirm that the pageview events are being sent on each navigation, but it sends the url as the bare /, which is probably why all my page views are on that page and not my hash-based router.

Eventually I will move away from hash-based routing on my site, but for now I’m sort of tied to it.

7 months ago

Thank you for your contribution. We’re moving this thread to Github: https://github.com/plausible/analytics/issues/173

7 months ago
1

Hash-based routing is now supported in Plausible. See the instructions here: https://plausible.io/docs/hash-based-routing

6 days ago
Changed the status to
Completed
6 days ago