Analytics wrapper for Umami
npm install @compilorama/statorama --save
Analytics wrapper that adds a couple of functionalities on top of Umami SDK:
- Diasables tracking when a search param
analytics=disabledis set. - Diasables tracking when a local storage item with key/value
analytics=disabledis found. - Disables tracking when user agent is considered a bot.
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,
})import statorama from '@compilorama/statorama';
statorama.track(
String, // Event Name (Ex.: 'Button Clicked')
Object // Event Data (Ex.: { name: 'Subscribe' })
)-
Install Node. Download the "Recommend for Most Users" version.
-
Clone the repo:
git clone git@github.com:compilorama/statorama.git- Go to the project directory:
cd statorama- Install the project dependencies:
npm install- Build the project:
npm run buildEnsure that all code that you have added is covered with unit tests:
npm run test -- --coverage