An analytics server that doesn't undermine user's privacy
Google Analytics is the de-facto standard in the web and mobile analytics service world.
- It's easy to setup and start tracking users behaviors
- It provides advanced reporting features.
But it has several serious privacy implications:
- Most of the time personal data is collected without the explicit consent of the user, hence it undermines user's privacy
- It's closed-source
- It does not embrace transparency at all
- Users cannot access tracked data because data ownership is granted only to the website/app owner (and sadly to Google)
- It targets specific users and data collected is not anonymous
What is Fair Analytics
Fair Analytics is an open, transparent, distributed and fair Google Analytics alternative.
- Fair - It's meant to provide lightweight and anonymous analytics about traffic and usage, not to track behaviors nor geographical locations of users
- Distributed - Raw traffic data is written in an append-only, secure, and distributed log. It uses hypercore under the hood
- Transparent - Raw traffic data is accessible to anyone. This makes it auditable and gives back its ownership to the crowd
- Easy - It's easy to setup
- Flexible - Even though Fair Analytics only stores raw data, it's pretty easy to listen to incoming events, enabling the user to manipulate/aggregate raw data in order to provide graphs or charts. Get fancy if you want to.
There are 2 ways of running Fair Analytics
npm install -g fair-analyticsfair-analytics
The command accepts some options:
$ fair-analytics --helpUsage: fair-analytics [options] [command]Commands:help Display helpOptions:-h, --help Output usage information-H, --host [value] Host to listen on-m, --memory Use in-memory storage-o, --origin [value] Accepts POST requests only from a specified origin-p, --port <n> Port to listen on-s, --storage-directory [value] Storage directory
The instance is now running at
Add fair-analytics as a dependency to your project
const path =const fa =const server =const feed = serverfeed
The instance is now running at
The quickest way to start tracking usage is to use fair-analytics-client-api
// create a fa instanceconst fa =// track eventsfa
Please refer to the fair-analytics-client-api documentation for further details
Fair Analytics responds to 3 endpoints:
Responds with a basic homepage, displaying the
Used to POST tracked events.
Responds with 204 in case of success (the body MUST be an object containing at least an
Gets realtime updates via server sent events Useful to create real-time dashboards
Consuming real-time data is as easy as:
if windowEventSourceconst source = ''sourcesourcesource
Provides an aggregated view of all the events stored, grouped by
In this case data is persisted to a local JSON file using lowdb
Here is an example response:
Replicate raw data
As we said Fair Analytics is distributed. It's easily possible to replicate raw data.
const hypercore =const swarm =const KEY = 'A FAIR ANALYTICS FEEED KEY'const LOCALPATH = './replicated.dataset'const feed =feed
$ npm test