If you don’t have a Next.js app yet, you can quickly create one with the following command:

npm create next-app@latest
1

Install

Now install the safesight package

  npm install safesight
2

Intializing Safesight

Add the provider in your apps root layout, with your previously created websites token.

/app/layout.ts
import { Analytics } from 'safesight/react'
 
export default function RootLayout({ children }: { children: React.ReactNode }) {
	return (
		<html lang='en'>
			<head>
				<title>Next.js tracked with Maple</title>
			</head>
			<body>
				{children}
				<Analytics token={'yourWebsiteID'} />
			</body>
		</html>
	)
}
3

Running your NextJS app

  bun run dev
4

Thats it!

Go to your web console and you will see debug logs showing you some page views logs. And once deployed data will come in!

5

Deploy and wait for data