Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider hash as part of the path #3241

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

ahocevar
Copy link
Contributor

The tracker script already sends paths correctly with their hash part, but the database does not store them yet in url_path. So the UI cannot show them.

This pull request implements the missing piece of what was already described in #2960:

Untitled

Copy link

vercel bot commented Feb 20, 2025

@ahocevar is attempting to deploy a commit to the umami-software Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR adds support for hash-based routing by including URL hash fragments in the stored path, enabling proper analytics tracking for single-page applications that use hash-based navigation.

  • Modified src/app/api/send/route.ts to concatenate currentUrl.hash with currentUrl.pathname when storing event paths
  • Maintains compatibility with REMOVE_TRAILING_SLASH environment variable while adding hash support
  • Completes implementation of hash-based routing tracking feature requested in issue feat: Add support for hash-based routing tracking #2960
  • Enables accurate path analytics for SPAs using hash-based routing in the UI dashboard
  • Aligns backend storage with existing tracker script behavior that already captures hash fragments

💡 (2/5) Greptile learns from your feedback when you react with 👍/👎!

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@ahocevar
Copy link
Contributor Author

ahocevar commented Feb 21, 2025

Let me know if this should be turned on through an env variable (ADD_HASH_TO_PATH?), instead of always adding the hash to the path. However, I think the existing data-exclude-hash tracker script option should be sufficient.

@mikecao
Copy link
Collaborator

mikecao commented Feb 25, 2025

We are actually planning on adding a new column to the schema, url_hash, where we will store this data. That way users can decide to query the data if they want. The exclude hash setting will still apply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants