Installation Guidelines
Next.js
How to add Faurya to your Next.js App Router (v13+) project.
Add Faurya to your Next.js App Router project
Follow these steps to integrate Faurya analytics into your Next.js application using the App Router (v13+).
Add tracking script to Root Layout
The recommended way to add scripts to all pages in a Next.js App Router application is by using the root layout file.
- Open your project's root layout file, typically located at
app/layout.jsx. - Import the
Scriptcomponent fromnext/script. - Add the Faurya tracking script to the
<head>section of your layout component.
// app/layout.jsx import Script from "next/script";export default function RootLayout({ children }) {return ( <html lang="en"> <head> <Script defer data-website-id="YOUR_WEBSITE_ID" data-domain="yourdomain.com" src="https://faurya.com/js/script.js" /> </head> <body>{children}</body> </html>);}Replace yourdomain.com with your website's root domain.
- Save the file, commit and deploy your changes.
Faurya is disabled on localhost to avoid tracking your own traffic.
Verify installation
After deploying your changes:
- 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/