Skip to content

fix: URL hash is not included in record #3445

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

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

Conversation

Nambers
Copy link

@Nambers Nambers commented May 22, 2025

fix #3444

Copy link

vercel bot commented May 22, 2025

@Nambers 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
Contributor

@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 fixes URL hash tracking in Umami analytics by appending the hash component to the pathname when recording events, addressing issue #3444 where data-exclude-hash="false" was not working as expected.

  • Modified src/app/api/send/route.ts to include currentUrl.hash in the urlPath variable for event tracking
  • Ensures proper handling of URLs with hash fragments like test/albums/de25/#ea03593jpg

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

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

@@ -145,7 +145,7 @@ export async function POST(request: Request) {
const base = hostname ? `https://${hostname}` : 'https://localhost';
const currentUrl = new URL(url, base);

let urlPath = currentUrl.pathname === '/undefined' ? '' : currentUrl.pathname;
let urlPath = currentUrl.pathname === '/undefined' ? '' : currentUrl.pathname + currentUrl.hash;
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider handling empty hash values to avoid appending '#' with no value

Copy link
Author

Choose a reason for hiding this comment

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

hmm I don't think this is an issue here? it's not hurt to add empty trailing string

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.

data-exclude-hash="false" seems not work
1 participant