Claude Code
Strong at the ingestion endpoint, hashing logic and SQL aggregation queries.
Analytics · updated 2026-11-03
Medium: Yes, with care You can build simple, privacy-friendly pageview analytics in a day, but it will not save money because Google Analytics is free.
Google Analytics 4 costs nothing for almost every small site, so building your own is about privacy, simplicity and learning rather than savings. A cookieless tracker that records pageviews, referrers and countries is a good vibe coding project. Ingesting events reliably at scale, filtering bots, and keeping queries fast as data grows are where it gets harder, which is why indie tools like Plausible and Fathom exist as paid products.
Google Analytics is free web analytics from Google for traffic, sources, events and conversions. This page is about building your own version for personal or internal use, or to learn how this kind of product works, not about copying Google Analytics to compete with it. How we grade.
Difficulty is for a solo builder using an AI coding tool. Skip means not worth building yourself.
| Feature | Difficulty | Why |
|---|---|---|
| Tracking script | Easy | A few lines that post the URL, referrer and screen size; keep it under 2 KB. |
| Unique visitors without cookies | Medium | Hash IP plus user agent with a salt that rotates daily, and never store the raw IP. |
| Dashboard of pages, sources, countries | Easy | Group-by queries over an events table, rendered with a chart library. |
| Custom events and goals | Easy | A named event call plus a goals table. |
| Bot filtering | Medium | User agent lists and headless browser checks catch most of it. |
| High-volume ingestion | Hard | Postgres works for small sites; busy sites need batching or a columnar store like ClickHouse. |
| Funnels and cohorts | Hard | Complex queries that get slow quickly. |
| Google Ads and Search Console integration | Skip | Only GA has this tight integration with Google's ad products. |
Your own version vs Google Analytics, at personal or small-team scale.
Google Analytics 4 (standard): Free
Free for standard properties; the enterprise Analytics 360 tier is sold through sales.
Source: marketingplatform.google.com/about/analytics/compare. Prices change; check before deciding.
| Running cost | Per month | Notes |
|---|---|---|
| Hosting for collector and dashboard | $0–$20 | Edge or serverless functions on a free tier for low traffic. |
| Database | $0–$25 | Supabase or Neon free tier for small sites; ClickHouse Cloud costs more at volume. |
| Domain or subdomain | $0–$1 | Serve the script from your own domain. |
| Total | $0–$46/mo | Google Analytics is free, so the reasons to build are control, privacy and learning, not money. |
Strong at the ingestion endpoint, hashing logic and SQL aggregation queries.
Generates a clean dashboard UI with charts that you can drop into Next.js.
Runs the collector and database in one place, useful for a quick prototype.
Paste it into your tool, then ask for a plan before any code. Edit the specifics to match what you need.
Build a lightweight, cookieless web analytics tool for my own websites (internal use). Stack: Next.js API routes on the edge, Postgres (Supabase), a dashboard with charts. Data model: sites (id, domain, owner_id), events (id, site_id, ts, path, referrer_host, country, device, browser, visitor_hash, name), salts (date, value). Features: 1. A tracking script under 2 KB that sends a pageview on load and on client-side route changes, plus window.track(name) for custom events. 2. Collector endpoint that accepts events only for registered domains, derives country from request headers, and computes visitor_hash = sha256(daily_salt + site_id + ip + user_agent). Never store raw IPs. 3. Delete salts older than one day so visitors cannot be tracked across days. 4. Dashboard (login required) with visitors, pageviews, top pages, referrers, countries and devices for a date range. 5. Basic bot filtering by user agent. Security: validate and size-limit every incoming field, check the Origin header against the site domain, rate-limit the collector, keep dashboards private with row level security, and add a privacy page describing what is collected.
AI tools often get these wrong by default. Check each one before anyone else uses the app.
They went far past the prototype: support, payments, reliability and years of iteration. Their profiles show what that took.
Uku Täht built Plausible Analytics
Open source, privacy-first analytics co-founded with Marko Saric.
Jack Ellis built Fathom Analytics
Privacy-first analytics with no cookie banner needed.
Adriaan van Rossum built Simple Analytics
Cookieless analytics, $50K+ MRR.
If you need Google Analytics's job done rather than a project, these are built and supported by independent makers.
plausible.io
Simple, cookie-free, open source web analytics that respects visitor privacy.
usefathom.com
Simple, privacy-first website analytics with no cookie banners required.
umami.is
Open-source, privacy-focused web and product analytics; self-host free or use Umami Cloud.
datafa.st
Revenue-first web analytics that shows which traffic sources bring paying customers.
countvisits.com
Web analytics you pay for once and use forever.
simpleanalytics.com
Privacy-first, cookieless web analytics and Google Analytics alternative.
You learn event ingestion, privacy-preserving visitor counting and how to write aggregate SQL that stays fast.
Medium. You can build simple, privacy-friendly pageview analytics in a day, but it will not save money because Google Analytics is free.
A working personal or internal MVP takes about 4–10 h with a tool like Claude Code. A polished version you would rely on every day takes about 5–10 days, mostly spent on ingesting high event volume without losing data or slowing the site.
Expect $0–$46/mo at personal or small-team scale (hosting for collector and dashboard, database, domain or subdomain). Free for standard properties; the enterprise Analytics 360 tier is sold through sales.
A simple pageview tracker with a dashboard is a one or two day vibe coding project. Matching GA4's funnels, attribution and ad integrations is not realistic.
No. Google Analytics 4 is free for normal sites, so the reasons to build or switch are privacy, simpler reports and avoiding cookie banners.
Indie-made tools such as Plausible, Fathom, Simple Analytics and Umami count visitors without cookies, and Umami and Plausible can be self-hosted.
Building your own tool that solves the same problem is common and generally fine. Copying Google Analytics's code, design assets, brand name or content is not. Use your own name and design, respect their terms of service, and get proper advice if you plan to sell it. This page is not legal advice.