Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

292 B
Raw Blame
export function getTrackedPathname(url: URL, trackUrlFragments = false): string {
  if (url.hash.startsWith("#/")) {
    return url.hash.substring(1);
  }
  if (url.hash.startsWith("#!/")) {
    return url.hash.substring(2);
  }
  return url.pathname + (trackUrlFragments ? url.hash : "");
}