Getting Started
React Page Tracker uses the History API to track the current page position when the user clicks the back or forward buttons in the browser or clicks a link. It calculates the current page position to determine the user's actions. At the same time, it enhances the history's lack of tracking browsing history and how the user navigated to the current page.
You can visit the demo to see how it works.
Features
- 📝 Identifies whether the user navigated to the page via browser back/forward buttons or by clicking a link.
- 🧩 Works with History.go(), history.forward(), history.back(), and history.pushState().
- 🐞 Fixes incorrect document.referrer after navigation, providing the correct referrer for tracking purposes.
- 💡 Accurately determines whether the current page is the first or last page.
- 🧭 Offers a complete history browsing record.
- 🚀 Supports Next.js, Remix, TanStack Query, and React Router.
- ⚡️ zero deps.
- ⭐️ typed-safe.