Privacy-first analytics.
npm install @compilorama/staly --save
Staly is based on Plausible by default, but you can optionally use another service. See Adapters section below to learn more.
import Staly from '@compilorama/staly';
const staly = new Staly();
staly.init('glorious.codes');
staly.trackPageview();
To avoid being tracked by any site using Staly, set analytics
search param as disabled
. Your preference will be set in a cookie and the following visits won't be tracked even without declaring the analytics search param on url.
https://glorious.codes?analytics=disabled
/*
** @token: String [required]
** @options: Object [optional]
*/
// Domain registered on Plausible
const token = 'compilorama.com';
// Local development is not tracked by default, but you can make it work by
// setting trackLocalhost option as true on initializaton.
const options = { trackLocalhost: true };
const staly = new Staly();
staly.init(token, options);
staly.trackPageview();
You can optionally use Staly with the following adapters. Click over one of them to get specific instructions:
-
Install Node. Download the "Recommend for Most Users" version.
-
Clone the repo:
git clone [email protected]:compilorama/staly.git
- Go to the project directory:
cd staly
- Install the project dependencies:
npm install
- Build the project:
npm run build
Ensure that all code that you have added is covered with unit tests:
npm run test -- --coverage