Installation Guidelines
React Router
How to add Faurya to your React Router project.
Add Faurya to your React Router project
Follow these steps to integrate Faurya analytics into your React Router application.
Add tracking script to root component
The recommended way to add scripts to all pages is by adding it to your root component.
- Open your project's root component (usually
App.jsxormain.jsx). - Add the Faurya tracking script to the
<head>section:
// App.jsx
import { Helmet } from "react-helmet-async";
export default function App() {
return (
<>
<Helmet>
<script
defer
data-website-id="YOUR_WEBSITE_ID"
data-domain="yourdomain.com"
src="https://faurya.com/js/script.js"
/>
</Helmet>
{/* rest of your app */}
</>
);
}Replace yourdomain.com with your website's root domain.
Alternative: Using public/index.html
You can also add the script directly to your public/index.html file:
<script
defer
data-website-id="YOUR_WEBSITE_ID"
data-domain="yourdomain.com"
src="https://faurya.com/js/script.js"
></script>Verify installation
After implementing either method:
- Visit your live website
- Check your Faurya dashboard for incoming data
- It might take a few minutes for the first pageviews to appear
For advanced configuration options like localhost tracking, custom API endpoints, or cross-domain setup, see the script configuration reference.