Skip to content
tidesight-analyticsPublic

About

Self-hosted free web analytics that keeps every raw hit: pageviews, events, heatmaps, session replays, Web Vitals and errors, on cheap shared hosting with Python's standard library, SQLite and cron. Try the live demo in your browser.

Topics

Resources

Contributing

Security policy

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

53 Commits

Folders and files

Repository files navigation

Tidesight

Self-hosted web analytics that keeps every raw hit.
Traffic ebbs and flows like a tide; sight is the insight you get from watching it.

Live demo · Website · Get started · Documentation

Latest release Licence: MIT Python 3.9+ Live demo

The Tidesight dashboard: overview of a surf shop's last 30 days, with visitors, visits, pageviews, bounce rate and visit duration against the previous period, a daily traffic chart, channels and top pages

Tidesight is web analytics you host yourself, for any number of websites. A small tracker sends every pageview, event, click, scroll, Web Vital and error to a collector that stores them raw, on your server. Jobs then derive sessions, places, devices, channels, bots and identities, and a dashboard as complete as the big tools shows it all: comparisons, filters, segments, goals, funnels, retention, heatmaps, session replays and visitor timelines.

  • Collect with a small JavaScript tracker (ts.js, about 8 KB gzip) and plugins loaded only where they are switched on.
  • Ingest with a Python collector that uses only the standard library and appends every hit, raw, to SQLite. It runs on cheap shared hosting: FastCGI or CGI (or Passenger), cron, no daemons.
  • Analyse with re-runnable jobs, and a dashboard on top of a small JSON API that your scripts can use too.

Data-rich by default, every family of data points has a per-site switch, and a privacy mode (IP truncation or hashing, retention windows, Do Not Track and GPC, no fingerprinting) is a configuration change plus a clean-up job.

Live demo

Open the live demo: Tidesight's own dashboard and Python web app, compiled to WebAssembly (Pyodide) and running in your browser, on 60 days of made-up visits to three made-up websites: a surf shop, a magazine and a web app. Look around freely: it is read-only, and nothing leaves your browser. It is rebuilt every six hours, so its dates are always recent (the first visit downloads about 12 MB).

Get started

1. Try it on your computer

Python 3.9 or later, nothing else.

git clone https://github.com/tidesight-analytics/tidesight.git && cd tidesight-analytics.github.io
python tools/demo.py --out demo-data
python server/python/devserver.py --config demo-data/tidesight.toml --no-auth --port 8790

Then open http://127.0.0.1:8790/dashboard/. The demo sends 60 days of visits to the three made-up websites through the real collector and enrichment jobs (pages, campaigns, purchases, forms, errors, recordings, a few bots), which takes about a minute. --no-auth skips signing in; use it only on your computer.

The three demo properties in the dashboard: a surf shop, a magazine and a web app, each receiving data

2. Put it on your host

On Dreamhost or any host with Python (FastCGI or CGI) and cron, everything lives in one folder, the website's: the code in app/, the data in data/, the configuration beside them, behind an .htaccess that sends every request to the app. Tidesight checks from the outside, every ten minutes, that none of its files can be downloaded.

cd ~/stats.example.com        # the website's folder
curl -L https://github.com/tidesight-analytics/tidesight/releases/latest/download/tidesight.tar.gz | tar xz
cp app/server/python/tidesight.fcgi . && chmod 755 tidesight.fcgi
cp app/server/python/web.htaccess .htaccess
cp app/config/tidesight.example.toml tidesight.toml    # then set public_url, and add the cron lines

The step-by-step deployment guide covers the host check (tools/sqlite_host_test.py), HTTPS, the configuration, the cron lines and the firewall. A host that runs PHP but not Python web apps can collect with the PHP connector; Node and Cloudflare Workers work too.

3. Create the first account

The first time the dashboard opens, it asks for a setup code that Tidesight wrote on the server, so that a bot finding a new installation first cannot claim it.

The first-account form: the setup code read on the server, a user name and a password

4. Add your website

Properties → Add property: the website's address and time zone, what to record, and the line to paste into the <head> of its pages. The dialog turns green when the first visit arrives.

<script async src="https://stats.example.com/ts.js" data-site="example-com"></script>

Adding a property: the tracking code to paste, and a box waiting for the first visit

Custom events and known users take one more line each:

tidesight('track', 'signup', { plan: 'pro' });   // custom event
tidesight('identify', 'user-42');                 // known user
tidesight('ignore');                              // run once in your own browser to exclude it

Every command, the page markup (error pages, masking, elements to leave out), single-page apps, Content Security Policy and the no-JavaScript pixel are in docs/tracker.md; switching features per site, in docs/configuration.md.

5. Watch the tide come in

Visitors appear on the Realtime page within seconds; reports fill in as the cron job runs, every couple of minutes.

Realtime: visitors in the last five minutes, pageviews per minute, active pages and referrers

6. See what people searched for

Connect Google Search Console and Bing Webmaster Tools once (free, about ten minutes, step by step in the property's Search engines settings: docs/search-engines.md), and the Search engines report shows the queries that bring visitors, with clicks, impressions and positions, next to the visits, bounce rate and conversions of each landing page.

The Search engines report: clicks, impressions, CTR, average position and visits, their trend, and the queries with their changes

7. Bring your history

Coming from Google Analytics 4, Plausible or Matomo? Property settings → Import history brings their daily figures (pages, sources, channels, countries, devices…) into the reports, for the days before Tidesight's own data: docs/history.md.

8. Invite your team, stay up to date

Admins invite people from the Users page with one-time links (no email involved) and choose their role: admin or viewer. Once a day Tidesight looks for a new release; an admin clicks Update, and Tidesight downloads it at once, checks it, puts it in place and keeps the previous version for a rollback. The tracking code on your sites never changes: ts.js is served by Tidesight, so it follows.

The Users page: people with their roles, an invitation waiting, and their last sign-in

The dashboard

Overview, realtime, acquisition (channels, sources, mediums, campaigns, referrers), search engines (Google Search Console and Bing Webmaster Tools: queries, clicks, impressions, positions, landing pages), content (pages, entry and exit pages, titles, error pages), locations, technology, events and their properties, goals and conversions, an explorer for any dimension, funnels, paths (a flow of the visits' pages, and what comes before and after a page), retention cohorts, heatmaps (clicks, rage and dead clicks, mouse, scroll reach), replays, forms, site search, Web Vitals, errors, visits with a timeline, visitor profiles, properties, people and a status page.

  • Analysis as in the big tools: compare any period with the previous one, the same days a year before or any range (dashed in charts, changes everywhere); filter every report by any dimension with is, is not, contains, does not contain, starts with, or with a click on a row; save filters as segments; mark days with annotations; set goals and see their conversions in every report.
  • Report tables with server-side sort, search and paging, totals and shares, a second dimension, a column chooser, row actions, up to five rows plotted over time, and every matching row exported to Excel, CSV, TSV or JSON. An export dialog says exactly what each download holds, raw datasets included.
  • Properties managed in the dashboard: add a site (domains, name, time zone, what to record) and get its tracking code with a live check of the first hit; change its settings, goals, privacy and public page; delete it with or without its data.
  • People managed in the dashboard: the first account with a setup code read on the server; then invitations as one-time links, roles (admin or viewer), password links for forgotten passwords.
  • Sign-in page, a command palette (Ctrl/⌘ K) and keyboard shortcuts, a freshness indicator, light and dark themes, a table twin for every chart, optional public share pages. Everything it shows comes from a JSON API.
Acquisition report: channels over time and a table of channels with visitors, visits, pageviews, bounce rate and duration, with their changes Filter builder: Country is United States or Germany, chosen from a list of countries with their visitor counts
Reports and comparisonsFilters on any dimension
Click heatmap of a product page drawn over its DOM snapshot, with the most clicked elements and their rage and dead clicks A session recording replayed in the dashboard, with the visit's details
HeatmapsSession replay
A visit's timeline: pageviews, clicks, Web Vitals, scroll and events, with the visit's source, location and device A funnel from the home page to a product, add to cart, checkout and purchase
Visit timelineFunnels
Paths: a flow of the visits' first four pages, with bands from page to page Search engines report, landing pages: clicks, impressions, CTR and position from Google, with the visits, bounce rate and engaged time Tidesight recorded
PathsSearch engines and landing pages
World map shaded by visitors per country, with city markers Core Web Vitals at the 75th percentile, their daily trend and per page
LocationsWeb Vitals

What it records

Traffic Pageviews with full context (referrer, UTM and click ids, screen, language, time zone, high-entropy Client Hints), SPA route changes (History API and #hash routes), custom events with properties, user ids, 404 pages, site search.
Visitors A persistent visitor id (first-party cookie + localStorage, optionally a server-set cookie), sessions with idle timeout, engaged time (visible, focused, not idle), new vs returning, identity stitching across devices and ids.
Behaviour Clicks with element-relative heatmap positions, rage, dead and error clicks, outbound links and downloads, scroll depth, form analytics (timings and abandonment, never values), mouse movement, copy and selection, ad-blocker detection.
Quality Web Vitals (LCP, INP, CLS, FCP, TTFB), Navigation Timing, long tasks, JavaScript and resource errors (de-duplicated).
Replay Session recordings with rrweb (sampled, passwords never recorded, inputs masked by default) and DOM snapshots that keep heatmaps accurate when layouts change.
Server side Raw IP and every request header (credentials and other cookies redacted), the raw payload, receive time and client time.
Derived Geolocation (MaxMind GeoLite2, downloaded without an account; ip-location-db's country check; DB-IP Lite; IPinfo Lite; read by a pure-Python reader), browser, OS and device from the user agent and Client Hints, bot classification, GA4 channel grouping (including AI assistants), a cookieless daily visitor hash, daily rollups.

Behaviour plugins have a per-site sampling rate. The full catalogue is in docs/datapoints.md.

How it works

 browser ── ts.js + plugins ──▶ collector (/collect, /chunk, /p.gif)
                                   │  appends raw, flags anything odd, never enriches
                                   ▼
                          events.db  (raw hits)        replay.db  (recordings, mouse, snapshots)
                                   │
                cron: jobs.py enrich, rollup, backup, privacy-clean, …
                                   ▼
                          derived.db  (sessions, pageviews, geo, devices, bots, identity, rollups)
                                   │
                         api.py (JSON) ──▶ dashboard (static, no build step)

derived.db can be deleted at any time: it is rebuilt from the raw data. Running processes pick new code up by themselves, database migrations run automatically, and when the way data is derived changes, the next enrichment rebuilds it from the raw hits. Details in docs/architecture.md, and the reasoning behind each choice in docs/design.md.

Besides the Python collector, connectors for PHP, Node and Cloudflare Workers (D1) speak the same protocol and write the same schema, checked by a shared conformance suite (docs/connectors.md).

Security and abuse protection

  • The collector is a public endpoint, so it is bounded: body sizes and gzip expansion are capped. Each client (an IPv4 address or an IPv6 /64) has per-minute allowances for requests and kilobytes, with separate allowances for recordings; once over it, its requests are refused before their body is parsed. Junk traffic (unknown sites, wrong origins, malformed bodies) gets its own small allowance, an optional daily quota per site caps storage, and writes stop with a 503 when disk space runs low (details).
  • The tracker cannot flood it either: it caps its own events and uploads per minute, splits batches under the collector's size limit, and backs off on errors. It trusts nothing on the host page: markup injected into a page cannot redirect it or make it load another script.
  • No secrets are stored: credentials and other sites' cookies are redacted from headers. Tokens, passwords, session ids and signatures in URLs are replaced by redacted before they leave the browser (and in the Referer the collector keeps). Form values are never collected, and session replays mask inputs and rich-text editors.
  • The dashboard is protected: people sign in with a form (PBKDF2 hashes, throttled guessing, an HttpOnly SameSite=Strict session cookie whose token is stored only as a hash and ends when the password changes); scripts may use HTTP Basic. Passwords travel over HTTPS only. Every change needs the dashboard's own header and origin, and only admins change properties and people. The pages have a strict Content Security Policy that keeps recordings from contacting other hosts. Public share pages are optional, token-protected, rate-limited, and never show figures for fewer than 3 visitors.
  • Audited: the collectors, the tracker and the dashboard went through adversarial security reviews, and every finding was fixed and covered by tests (docs/roadmap.md). To report a vulnerability, see SECURITY.md.

Development

Task Command
Python tests python -m pytest
Tracker build and browser tests cd tracker && npm install && npx playwright install chromium && npm test
Dashboard browser tests cd tracker && npm run test:dashboard (demo data, four local servers)
Connector conformance TIDESIGHT_CONNECTORS=php python -m pytest server/python/tests/test_conformance.py
Screenshots (docs/images) python tools/demo.py --out demo-data --public-url https://stats.example.com/ then node tools/screenshots.mjs --data demo-data
Website and live demo cd site && npm ci && cd .. && python tools/build_site.py --out _site (published by .github/workflows/pages.yml)

Contributors and coding agents: start with AGENTS.md and CONTRIBUTING.md.

Documentation

Status

Every phase of the plan is built and tested: collector, tracker, enrichment, behaviour plugins, session replay, dashboard and API, people and updates, privacy mode and maintenance jobs, and the PHP, Node and Worker connectors. It runs in production on Dreamhost shared hosting (FastCGI, SQLite with WAL, everything in one folder). Still open: trying the PHP and Worker connectors on live hosts. See docs/roadmap.md.

Licence

MIT, see LICENSE. Vendored third-party code keeps its own licence: rrweb and rrweb-player (MIT), the Fraunces and IBM Plex fonts (SIL OFL 1.1), country outlines from Natural Earth via world-atlas (ISC), and the GitHub mark from Octicons (MIT). Geolocation databases are downloaded by the jobs, never bundled; GeoLite data (CC BY-SA 4.0 and MaxMind's GeoLite EULA) and DB-IP Lite data (CC BY 4.0) require attribution, which the dashboard shows; ip-location-db's user-country is public domain (PDDL). The website's live demo runs on Pyodide (MPL 2.0), fetched when the website is built.

About

Self-hosted free web analytics that keeps every raw hit: pageviews, events, heatmaps, session replays, Web Vitals and errors, on cheap shared hosting with Python's standard library, SQLite and cron. Try the live demo in your browser.

Topics

Resources

Contributing

Security policy

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages