Lightweight Google Analytics Alternative
Learn more
Introduction ·
Features ·
Tech Stack ·
Self-hosting ·
Local Development
Understand your website traffic with essential insights. No cookies, no personal data collection, just the stats that matter.
Privacy Focused: No cookies or invasive tracking. Respects user privacy by default.
Lightweight Script: Our tiny script (~1.2kB) won't slow down your website's performance.
Essential Metrics: Focus on key data like page views, visitors, referrers, and more.
Simple Interface: Clean and intuitive dashboard to easily understand your data.
Own Your Data: Self-hostable solution giving you full control over your analytics.
Easy Integration: Add a simple script tag to your website and start tracking.
- Next.js – framework
- TypeScript – language
- Tailwind – CSS
- Analytics – self-served analytics
- Neon – database
- BetterAuth – auth
- Vercel – deployments
You can self-host for full control over your analytics.
Step 1: Fork and clone the repo
git clone https://github.com/<username>/analytics.ritiksharma.me.git
Step 2: Copy .env.example to .env
cp .env.example .env
Step 3: Create a database project in Neon and paste the connection string in the .env file for DATABASE_URL
Generate a secret key and add it to .env for BETTER_AUTH_SECRET
Get your Google credentials (more info here) and add the client ID and client secret to .env for GOOGLE_CLIENT_ID
and GOOGLE_CLIENT_SECRET
Step 4: Install dependencies and run the command to push the database tables to Neon DB
pnpm i
pnpm db:push
Step 5: Deploy to Vercel and add all environment variables to your Vercel project settings. Change NODE_ENV
to "production" and update BETTER_AUTH_URL
with your domain URL.
Set up local dev environment:
Follow Steps 1-4 from the self hosting section, then:
Step 4: Optionally create a dev branch in the Neon DB and add its connection string to .env for DATABASE_URL
Step 5: Sign in first to create an initial user and seed the data
pnpm db:seed
Step 6: Run in dev mode
pnpm dev
Thanks! Happy Coding.