index.html. Because it’s a single-page app, one tag in the HTML shell covers every route — client-side navigation is tracked automatically.
Before you start
- A tinyanalytics site. If you don’t have one yet, follow the Quickstart.
- Your site’s numeric site ID, from Settings → Tracking in your dashboard.
Add the snippet to index.html
Open theindex.html at the root of your project (Vite) or in public/ (Create React App), and add the snippet inside <head>:
index.html
Client-side routing is tracked automatically
React apps change routes on the client (with React Router or similar), and tinyanalytics records each route change as a new pageview by default (data-track-spa). You don’t need to hook into your router. See Track single-page apps to change this behavior.
Verify
Run your app, open it in a browser, then check Realtime in your dashboard for your visit. See Verify your setup for the full check.Your install is working when your own visit appears in Realtime in your dashboard.
Related
Install on Next.js
A Next.js app instead.
Track custom events
Send events from your components.
Configure the tracking script
Every
data-* option you can set.Verify your setup
Confirm tracking works.