About this project
Cairn is a Composer package that adds web analytics directly inside a Laravel application. Installation is described as a single composer require followed by php artisan migrate, after which a dashboard is available at /cairn. Because tracking runs inside the application rather than through a browser tag, it can report on route names, Eloquent models and authenticated users.
Privacy model: visitors are identified by a salted hash that is regenerated from new random bytes every 24 hours, with the previous salt destroyed. The README spells out the consequences: returning visitors cannot be counted, multi-day journeys and multi-touch attribution are impossible, and cross-device tracking does not exist. In exchange, the default configuration stores nothing on the visitor's device, keeps no IP address in database, logs or backups, and needs no cookie-consent banner; a breach of the analytics table would leak counts rather than people. Two optional settings change this and are off by default: privacy.track_user_id attributes entries to signed-in users, and privacy.durable_identity replaces the rotating hash with a cookie. Country reporting is also off by default and uses a local MaxMind GeoLite2 file downloaded with cairn:geoip rather than a per-request third-party lookup.
Dashboard and reporting: the dashboard is server-rendered Blade, reads without JavaScript, uses links for filters and server-computed inline SVG charts, and places a table under every chart. Eighteen widgets ship by default and three more are one config line away. Widgets are classes that can be reordered, removed or subclassed, including a dimension widget for ranked tables. Every surface, including dashboard, API, Pulse cards and CSV export, goes through one query layer. A report builder supports metrics such as visitors, pageviews and bounce rate grouped by dimensions such as route, with period comparison, ordering and limits. Derived metrics are recomputed from their stored components at the level displayed rather than averaged, and requesting something that was never rolled up throws instead of scanning raw entries.
Operations: requirements are PHP 8.2+, Laravel 12 or 13, and MySQL 8+, MariaDB 10.6+ or PostgreSQL 13+. Redis is optional, and every Redis-backed capability is said to have a database-backed driver of equal correctness tested against the same suite. There is no npm, Vite or Node build step. Artisan commands include cairn:rollup, cairn:prune, cairn:work, cairn:partition, cairn:doctor, cairn:geoip, cairn:forget and cairn:export. Rollup and prune are scheduled automatically unless already scheduled, and on hosts without cron a small fraction of requests carry the work. The dashboard route is guarded by a viewCairn gate that denies everybody outside the local environment until defined. Dashboard drivers are blade (default), livewire, inertia and none; neither Livewire nor Inertia is required, and naming an uninstalled one serves the Blade dashboard. An optional beacon measures time on page, scroll depth, screen size and Core Web Vitals.
Scope and license: the README lists deliberate non-goals, including following anyone across days, storing IP addresses, funnels, cohort analysis, heatmaps, session replay, A/B testing, attribution beyond last click, and behavioural bot detection. It states that Cairn cannot tell you whether a deployment complies with any regulation. The project is described as stable, following semantic versioning from 1.0.0, and is MIT licensed.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.