Nextract.js seamlessly adds free and privacy friendly web analytics to your Next.js app
Zero-config analytics in few lines of code
Why Nextract.js is better →Analytics without cookies or tracking
Own your data - keep everything in your system
Absolutely free
100% open source
Self hosting as easy as it gets
Integrates with your Next.js app and does the rest by itself
No external script needed
Bundled with your Next.js app served at once
Install Nextract.js, connect to your database and you're set.
/pages/api/nextract/[...nextract].js
1
2
3
4
5
6
7
8
9
10
import Nextract from "nextract";
import PrismaDatabase from "@nextract/database-prisma";
import { PrismaClient } from "@prisma/client";
const client = new PrismaClient();
export default Nextract({
database: PrismaDatabase(client)
});
/pages/app.jsx
1
2
3
4
5
6
7
8
9
import { NextractProvider } from "nextract/client";
export default function MyApp({ Component, pageProps }) {
return (
<NextractProvider>
<Component {...pageProps} />;
</NextractProvider>
);
}
/pages/app.jsx
1
2
3
import { Dashboard } from "nextract/client";
export default Dashboard();