Glorious Analytics
Privacy-first analytics.

Installation
npm install @glorious/analytics --save
Usage
Glorious Analytics is based on Plausible by default, but you can optionally use another service. See Adapters section below to learn more.
import GAnalytics from '@glorious/analytics';
const analytics = new GAnalytics();
analytics.init('glorious.codes');
analytics.trackPageview();
To avoid being tracked by any site using Glorious Analytics, 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
API
init
const token = 'glorious.codes';
const options = { trackLocalhost: true };
const analytics = new GAnalytics();
analytics.init(token, options);
trackPageview
analytics.trackPageview();
Adapters
You can optionally use Glorious Analytics with the following adapters. Click over one of them to get specific instructions:
Contributing
git clone git@github.com:glorious-codes/glorious-analytics.git
- Go to the project directory:
cd glorious-analytics
- Install the project dependencies:
npm install
npm run build
Tests
Ensure that all code that you have added is covered with unit tests:
npm run test -- --coverage