Repository navigation
Replies: 1 comment 1 reply
|
What you're seeing matches the server code in v3.4.0. Pageviews keep the hash, but Performance and Heatmaps throw it away when they save the path, so every hash route collapses into Where the hash is lost
I ran those three functions, copied from the v3.4.0 source, on hash URLs: The blank preview has an extra cause. The heatmap preview isn't a recorded snapshot. It loads your live site in an iframe at your website's domain plus the saved path (getHeatmap.ts#L568). With hash routing that's always A workaround for Performance today The tracker passes every request through the <script>
function umamiBeforeSend(type, payload) {
if (type === 'performance' && payload.url) {
const u = new URL(payload.url, location.href);
if (u.hash.startsWith('#/')) {
u.pathname = u.hash.slice(1).split('?')[0];
u.hash = '';
payload.url = u.toString();
}
}
return payload;
}
</script>
<script defer src="https://your-umami/script.js" data-website-id="..." data-performance="true" data-before-send="umamiBeforeSend"></script>With this, Heatmaps can't be fixed from the page. The recorder sends |
Uh oh!
There was an error while loading. Please reload this page.
Hi all!
Is anyone using hash routing in their application and has managed to get Heatmaps and Performance metrics working correctly?
We're seeing a couple of issues:
Heatmaps
Performance
Standard analytics and page tracking works, but Heatmaps and Performance don't appear to correctly distinguish between routes.
Has anyone successfully used Heatmaps and Performance with hash routing? If so, did you need any special configuration or workaround to get accurate results?
Any insights would be appreciated.
Thank you!
All reactions