Skip to content

compilorama/statorama

Repository files navigation

Statorama

Analytics wrapper for Umami

CircleCI Coverage Status

Installation

npm install @compilorama/statorama --save

Usage

Analytics wrapper that adds a couple of functionalities on top of Umami SDK:

  • Diasables tracking when a search param analytics=disabled is set.
  • Diasables tracking when a local storage item with key/value analytics=disabled is found.
  • Disables tracking when user agent is considered a bot.

Initializating

By initializing the lib, page view will be tracked automatically

import statorama from '@compilorama/statorama';

statorama.init({
  // Source where Umami SDK is requested from (required)
  src: String,
  // Umami Website ID (required)
  id: String,
  // Enable/Diasable tracking arbitrarily (required)
  enabled: Boolean,
})

Tracking Custom Events

import statorama from '@compilorama/statorama';

statorama.track(
  String, // Event Name (Ex.: 'Button Clicked')
  Object  // Event Data (Ex.: { name: 'Subscribe' })
)

Contributing

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

  2. Clone the repo:

git clone git@github.com:compilorama/statorama.git
  1. Go to the project directory:
cd statorama
  1. Install the project dependencies:
npm install
  1. Build the project:
npm run build

Tests

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

npm run test -- --coverage

About

Analytics wrapper for Umami

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors