umami-software / umami

Umami is a simple, fast, privacy-focused alternative to Google Analytics.
https://umami.is
MIT License
22.83k stars 4.24k forks source link

[Feature Request] Support for Hash-Based Routing Analytics #2954

Open DDDDD12138 opened 2 months ago

DDDDD12138 commented 2 months ago

Describe the feature or enhancement

Description:

I am working on a project that uses Vue 2 and Vue Router 3 with hash-based routing. While integrating Umami for analytics, I noticed that all collected page paths are recorded as /. This issue prevents accurate tracking of user navigation within the application.

Minimal Example

demo

Expected Behavior

Umami should correctly record the full hash-based paths (e.g., #/home, #/about) instead of just /.

Actual Behavior

All recorded paths are shown as /, regardless of the actual route.

Possible Solution

I noticed that in the parseURL function within the Umami script, it only retrieves URL.pathname. This results in the path always being recorded as / when using hash routing. Perhaps URL.hash could be used to capture the full path when using hash routing?

mikecao commented 2 months ago

We'll definitely get this added.

DDDDD12138 commented 1 month ago

Hello @mikecao ,

This PR #2960 should resolve the issue. Could you review it when you get a chance? Thanks!