🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@glorious/analytics

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glorious/analytics

Privacy-first analytics

Source
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

Glorious Analytics

Privacy-first analytics.

CircleCI Coverage Status

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

/*
** @token: String [required]
** @options: Object [optional]
*/

// Domain registered on Plausible
const token = 'glorious.codes';
// 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 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:

  • Google Analytics

Contributing

  • Install Node. Download the "Recommend for Most Users" version.

  • Clone the repo:

git clone git@github.com:glorious-codes/glorious-analytics.git
  • Go to the project directory:
cd glorious-analytics
  • Install the project dependencies:
npm install
  • Build the project:
npm run build

Tests

Ensure that all code that you have added is covered with unit tests:

npm run test -- --coverage

Keywords

analytics

FAQs

Package last updated on 30 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts