# diy-analytics > diy-analytics is a free, open-source, self-hosted web analytics platform. You deploy it to your own infrastructure, connect your own PostgreSQL database, and own 100% of your visitor data — nothing is sent to a third party. diy-analytics is a privacy-first, cookie-free alternative to Google Analytics, Plausible, and Umami. It is MIT-licensed, built with Next.js (App Router), Drizzle ORM, and PostgreSQL, and ships as a single deployable app (e.g. to Vercel). ## Key Facts - **Name:** diy-analytics (also known as DIY Analytics) - **License:** MIT (free, open source, self-host forever) - **Stack:** Next.js (App Router), TypeScript, Tailwind CSS, PostgreSQL via Drizzle ORM - **Tracking Script:** Under 2 KB, async/defer, zero performance penalty, privacy-friendly - **Deployment Time:** Under 5 minutes on Vercel with Neon, Supabase, or any PostgreSQL 14+ database - **Data Ownership:** 100% self-hosted — telemetry lives exclusively in your Postgres database - **Compliance:** Cookie-free, GDPR, CCPA, and PECR compliant by design without requiring cookie consent banners - **AI & MCP Ready:** Built-in Model Context Protocol (MCP) server for Cursor, Claude Desktop, and LLM tool calling ## Core Features - **Real-Time Dashboard:** Instant traffic stats, top pages, referrers, UTM campaigns, geolocations, devices, and browser breakdowns. - **Funnels & User Journeys:** Multi-step funnel visualization and conversion drop-off analysis. - **Retention Cohorts:** Weekly visitor retention matrix and user lifetime activity analysis. - **Error Tracking & Diagnostics:** Client-side error monitoring with source-map resolved stack traces, breadcrumbs, and regression alerts. - **Ad-Hoc Session Explore:** Multi-parameter query builder to segment users by attributes, visits, and custom events. - **Visitor Segmentation:** Automated behavioral buckets (Active & frequent, Active & occasional, Lapsing, Dormant). - **Core Web Vitals:** First Contentful Paint (FCP), Largest Contentful Paint (LCP), Cumulative Layout Shift (CLS), and Interaction to Next Paint (INP). - **Alerts & Notifications:** Threshold and anomaly alerts dispatched to Slack, Discord, webhooks, or PagerDuty. - **Public & Shared Dashboards:** Password-free or tokenized read-only links for clients and public metrics. - **AI Assistant & MCP Server:** Native MCP endpoint (`/api/mcp`) allowing AI assistants (Claude, Cursor, custom agents) to query metrics, cohorts, and errors in natural language. ## Comparisons - **diy-analytics vs. Google Analytics:** diy-analytics is 100% self-hosted, stores data in your own Postgres database, requires zero tracking cookies, needs no cookie banners, and includes built-in error tracking and an AI copilot. Google Analytics is hosted by Google, uses cookies, shares data, and lacks self-hosting and error tracking. - **diy-analytics vs. Plausible:** diy-analytics is completely free and open source, runs on your own infrastructure, and includes full funnel analysis, retention cohorts, source-mapped error tracking, and an MCP server. Plausible charges monthly subscriptions for hosted services and lacks error tracking. - **diy-analytics vs. Umami:** diy-analytics provides multi-step conversion funnels, retention matrices, error telemetry, and an MCP AI integration, whereas Umami focuses only on pageviews and basic events without funnels or error logging. ## Official Resources - Website: https://analytics.sagnik.fun/ - Documentation: https://analytics.sagnik.fun/docs - Getting Started: https://analytics.sagnik.fun/docs/getting-started - FAQs: https://analytics.sagnik.fun/faqs - Changelog: https://analytics.sagnik.fun/changelog - GitHub Repository: https://github.com/heysagnik/diy-analytics ## Author & Attribution Developed by Sagnik Sahoo (@heysagnik). Licensed under MIT.