Hashed page paths tracking
Track page views for Single Page Applications (SPAs) that use hash-based routing. This feature automatically detects when users navigate to different sections of your app using URL fragments (the part after #).
What are hashed page paths?
Hashed page paths are URLs that use fragments to navigate between different sections or pages within a single HTML document. For example:
https://yoursite.com/#home
- Home sectionhttps://yoursite.com/#about
- About sectionhttps://yoursite.com/#contact
- Contact section
Traditional web analytics often miss these navigation events because the browser doesn't reload the page when the hash changes. DataFast's hashed page paths tracking solves this by monitoring hash changes and recording them as separate page views.
How to enable hashed page paths tracking
Replace your regular DataFast tracking script with the hash-enabled version. Add this script to the <head>
section of your website:
<script
defer
data-website-id="yourwebsiteid"
data-domain="yourdomain.com"
src="https://datafa.st/js/script.hash.js"
></script> <!-- 👆 this is the only difference from the regular script -->
Note: Replace yourwebsiteid
with your actual website ID and yourdomain.com
with your domain.
That's it! DataFast will now automatically track:
- Initial page loads
- Hash changes (e.g., when users click internal links that change the URL fragment)
- All regular page navigation
Use cases
This feature is perfect for:
- Single Page Applications (React, Vue, Angular apps with hash routing)
- Landing pages with multiple sections accessed via anchor links
- Documentation sites with hash-based navigation
- Portfolio websites with hash-based section switching
Your analytics will now show separate entries for each hash-based "page" that users visit, giving you better insights into how users navigate through your content.