EarnedStats Docs

Install

Single page apps

React, Vue, Svelte and other client side routers.

The script listens to history.pushState and replaceState, so route changes in React Router, Next.js, Vue Router, SvelteKit and most others are counted with no extra code.

Hash routes

If your URLs look like /#/pricing, add data-hash. The part after # becomes the page. Plain #anchors are never counted as pages.

Manual pageviews

For routers the script cannot see, add data-manual and send each page yourself:

router.js
router.afterEach(() => {
  window.earnedstats?.('pageview');
});