Optic
Open source · MIT licensed · Self-hosted

Web analytics you own, with heatmaps and replays built in.

Optic gives you the reports you use in Google Analytics 4, the heatmaps and session recordings you use in Microsoft Clarity, and forecasting on top, in one Next.js app that stores everything in a single SQLite file on your own server.

Add one line to your site
<!-- in <head>, on every page -->
<script defer src="https://analytics.example.com/optic.js" data-site="YOUR_SITE_ID"></script>

Data collection and integration

  • One 6 KB script; single-page apps tracked automatically
  • Server ingest API for mobile apps, back ends, CRM and point-of-sale data
  • No-code tag manager: clicks, form submits and page rules become events
  • Cookieless by default, consent modes for the EU, optional DNT and GPC support

Traffic and audience

  • GA4-style channel grouping from UTM tags and referrers
  • Segments by country, device, browser, OS, language, campaign
  • Realtime view refreshed every 5 seconds
  • Every report filterable by any dimension

Behaviour

  • Automatic outbound clicks, downloads, form submits, video plays
  • Closed funnels with drop-off and time between steps
  • Path exploration before and after any page
  • Weekly retention cohorts

Conversions and e-commerce

  • Event and page goals with values
  • Revenue, orders, average order value
  • Cart and checkout abandonment
  • Products and revenue by channel

Experience (like Clarity)

  • Click and scroll heatmaps over the live page
  • Session recordings with masked inputs
  • Rage clicks, dead clicks and JavaScript errors
  • Core Web Vitals from real users

Automation and reporting

  • Anomaly detection with robust, weekday-aware baselines
  • Holt-Winters forecast with an 80% interval
  • "What changed" contribution analysis
  • Custom report builder with CSV export

Private by design

No cookies by default

Visitors are counted with a hash that uses a salt rotated every day. The salt is deleted, so nobody can be followed across days.

Your data stays with you

Everything lives in one SQLite file on your server. No third party sees a single pageview. Export any report to CSV.

Recordings mask input

Everything typed into form fields is masked before it leaves the browser. Add optic-block to hide any element.