Mongolytics Logo

Mongolytics

Effortless Traffic Tracking for Next.js

A free, open-source solution using MongoDB to give you full ownership of your websites traffic data.

Mongolytics Logo

Why Choose Mongolytics?

Everything you need to understand your audience, and it's completely free.

Open Source

Full transparency. Host it yourself, inspect the code, and contribute.

Next.js Optimized

Built specifically for the Next.js framework for seamless integration.

MongoDB Powered

Leverages the power and scalability of MongoDB for reliable data storage.

Easy Setup

Get up and running in minutes with our straightforward setup guide.

Privacy Focused

You own your data. No third-party scripts or data sharing.

Real-time Analytics

Get insights into your website's traffic and user behavior in real-time.

Get Started in Minutes

Integrate Mongolytics into your Next.js project with a few simple steps.

1. Install the package from NPM.

npm install @clipper-dev/mongolytics-next

2. Configure your environment variables.

# .env.local

MONGOLYTICS_URI="your-mongodb-atlas-connection-string"
MONGOLYTICS_DB_NAME="your-analytics-database-name"

3. Create the API endpoint.

// app/api/mongolytics/route.ts
import { mongolyticsAppRouteHandler as POST } from '@clipper-dev/mongolytics-next/server';

export { POST };

4. Add the tracking component to your root layout.

// app/layout.tsx
import { Mongolyth } from '@clipper-dev/mongolytics-next/client';

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        <Mongolyth />
        {children}
      </body>
    </html>
  );
}