# Trail > Self-hosted web analytics: a tracker under 2 KB, one Go binary, SQLite, private until the visitor says yes. Run it, add it, read it. One Go binary, SQLite, and a tracker under 2 KB. Start with the quickstart. ## Table of Contents ### Getting started - [Quickstart](https://trail.karanjot.co.in/docs/quickstart.md): Run Trail, add the script to a page and see your first visitor online, in three steps. - [First run in the dashboard](https://trail.karanjot.co.in/docs/dashboard/first-run.md): Sign in, add your website, install the script and see your first visit. The dashboard walks you through it the first time. ### Install - [Self-hosting](https://trail.karanjot.co.in/docs/install.md): Run Trail on your own server in one or two commands, with Docker, Docker Compose and automatic HTTPS, or a single binary under systemd. - [Docker](https://trail.karanjot.co.in/docs/install/docker.md): Run the published Trail image with one command, or with Docker Compose and Caddy for automatic HTTPS. - [Fly.io](https://trail.karanjot.co.in/docs/install/fly.md): Deploy Trail to one Fly.io machine with a volume for the database. - [Binary, systemd and Caddy](https://trail.karanjot.co.in/docs/install/binary.md): Install the Trail binary and a systemd service with one command, or build it yourself, and put Caddy in front for HTTPS. - [Rewrites (Vercel and others)](https://trail.karanjot.co.in/docs/install/rewrites.md): Serve the tracker and its endpoint from your own domain with a /_t/* rewrite. ### Add to a site - [Script tag](https://trail.karanjot.co.in/docs/add/script-tag.md): Add Trail to any site with one script tag, and every attribute it accepts. - [npm package](https://trail.karanjot.co.in/docs/add/npm.md): Install trail-analytics for typed track, identify and consent calls, and inject the tracker script once. - [React](https://trail.karanjot.co.in/docs/add/react.md): Add Trail to a React app with the Analytics component, then track events and set consent. - [Next.js](https://trail.karanjot.co.in/docs/add/nextjs.md): Add Trail to a Next.js app, with route templates such as /blog/[slug]. - [Vue and Nuxt](https://trail.karanjot.co.in/docs/add/vue-nuxt.md): Add Trail to a Vue app with inject(), or to Nuxt with a client-only plugin and a route rule. - [SvelteKit](https://trail.karanjot.co.in/docs/add/sveltekit.md): Add Trail to a SvelteKit app with inject() in the root layout, and proxy /_t/* from a server hook. - [Astro](https://trail.karanjot.co.in/docs/add/astro.md): Add Trail to an Astro site with a script tag in your base layout, and avoid double pageviews with view transitions. - [Plain HTML](https://trail.karanjot.co.in/docs/add/html.md): Add Trail to a static site with one script tag in the head, no build step, plus event tracking and consent. - [AI crawlers](https://trail.karanjot.co.in/docs/add/ai-crawlers.md): Capture AI crawler requests and serve the Trail script first-party with one command, npx trail-analytics init, for Next.js and Astro. ### Tracking - [Custom events](https://trail.karanjot.co.in/docs/tracking/custom-events.md): Send your own events with flat properties using trail.track(), and name them so goals keep matching. - [Named clicks](https://trail.karanjot.co.in/docs/tracking/named-clicks.md): Record clicks on chosen elements with a data-trail attribute and no JavaScript. - [Identify and journeys](https://trail.karanjot.co.in/docs/tracking/identify.md): Link visits to your own user ids so journeys follow people across visits and devices. - [Privacy modes and consent](https://trail.karanjot.co.in/docs/tracking/privacy.md): Choose between private until consent, always private and full tracking, and wire up a consent banner. - [Do Not Track and GPC](https://trail.karanjot.co.in/docs/tracking/dnt.md): Trail skips visitors who send Do Not Track or Global Privacy Control. See how to count them anyway with data-dnt="off". - [Web vitals, rage clicks, forms and errors](https://trail.karanjot.co.in/docs/tracking/extras.md): Opt-in extras that load a small second file only when you ask for them. - [Tracker cost](https://trail.karanjot.co.in/docs/tracking/cost.md): How big the tracker is, what it costs a page to load, and how to measure it yourself. ### Dashboard - [Overview](https://trail.karanjot.co.in/docs/dashboard/overview.md): The dashboard's layout, the sidebar, and what each number and panel on the Overview screen means. - [Compare, filter and share](https://trail.karanjot.co.in/docs/dashboard/navigating.md): Compare periods, filter every screen, jump with the command palette and share a read-only link. - [Live](https://trail.karanjot.co.in/docs/dashboard/live.md): Who is on your site right now, and the events as they arrive. - [Acquisition](https://trail.karanjot.co.in/docs/dashboard/acquisition.md): Where visits come from, by source, AI referrals, campaigns and landing pages. - [Activity](https://trail.karanjot.co.in/docs/dashboard/activity.md): Find a person, a visit or an event, and follow a visitor page by page. - [Conversions](https://trail.karanjot.co.in/docs/dashboard/conversions.md): Goals count a page or an event. Funnels follow people through ordered steps. - [Revenue](https://trail.karanjot.co.in/docs/dashboard/revenue.md): Revenue reported by your site through Purchase events, credited to a visit's first source. - [AI visibility](https://trail.karanjot.co.in/docs/dashboard/ai-visibility.md): How AI systems reach your site, from crawler requests to referred visits and conversions, plus the AI browsing agents that run your script. - [Settings](https://trail.karanjot.co.in/docs/dashboard/settings.md): Websites, install code, AI assistants, API tokens, share links, exports and config, all under Settings. - [Delivery health](https://trail.karanjot.co.in/docs/dashboard/delivery.md): See how many events reached the server and how many needed a retry, and what a rising retry share means. ### API - [Read API](https://trail.karanjot.co.in/docs/api/read-api.md): Query your stats over HTTP with a bearer token. - [MCP](https://trail.karanjot.co.in/docs/api/mcp.md): Let Claude Code, Cursor, VS Code and other assistants read your Trail stats. - [Keys and tokens](https://trail.karanjot.co.in/docs/api/tokens.md): The password, session secret and API tokens Trail uses, and what each one can reach. ### Operations - [Configuration](https://trail.karanjot.co.in/docs/operations/configuration.md): Every environment variable the Trail server reads, plus allowed origins, trusted proxies and Cloudflare, AI agent lists, the ingest rate limit, environments and the trail commands. - [Backups](https://trail.karanjot.co.in/docs/operations/backups.md): Back up and restore the single SQLite file that holds all Trail data. - [Geo database](https://trail.karanjot.co.in/docs/operations/geo.md): Where Trail gets a visitor's location, how accurate each level is, and how to add region and city with TRAIL_GEO_DB. - [Agent signature probe](https://trail.karanjot.co.in/docs/operations/agent-probe.md): A small test server in the Trail repository that shows whether an AI agent signs the requests a page sends, and whether those signatures verify. - [Upgrades](https://trail.karanjot.co.in/docs/operations/upgrades.md): Upgrade Trail to a new version over the same SQLite file, with no migrations to run by hand. - [Troubleshooting](https://trail.karanjot.co.in/docs/operations/troubleshooting.md): A step-by-step checklist for when events do not show up: script loading, HTTP status codes, allowed origins, environments and bots. ### Other - [Changelog](https://trail.karanjot.co.in/docs/changelog.md): What changed in each Trail release, newest first.