React
Add Reignat analytics to any React app — Vite, CRA, or custom setup.
Via index.html
The simplest approach: paste the script tag into your public/index.html or index.html before the closing </body>:
<body> <div id="root"></div> <script src="https://www.reignat.com/tracker.js" data-site="your-project-id" defer ></script></body><body> <div id="root"></div> <script src="https://www.reignat.com/tracker.js" data-site="your-project-id" defer ></script></body>Via component
Prefer loading it from your React tree? Add a small effect to your root App.tsx:
App.tsx
import { useEffect } from "react" export default function App() { useEffect(() => { const script = document.createElement("script") script.src = "https://www.reignat.com/tracker.js" script.dataset.site = "your-project-id" script.defer = true document.head.appendChild(script) }, []) return <>{/* your app */}</>}import { useEffect } from "react" export default function App() { useEffect(() => { const script = document.createElement("script") script.src = "https://www.reignat.com/tracker.js" script.dataset.site = "your-project-id" script.defer = true document.head.appendChild(script) }, []) return <>{/* your app */}</>}ℹ
The empty dependency array ensures the script is injected once on mount (not on every re-render).
Verify
Deploy your app and open it in a browser. Check your Reignat dashboard: a pageview should appear within seconds.
ℹ
Reignat ignores
localhost automatically. Test on your deployed URL, not the dev server.