https://github.com/compilorama/statorama
Analytics wrapper for Umami
https://github.com/compilorama/statorama
Last synced: 11 months ago
JSON representation
Analytics wrapper for Umami
- Host: GitHub
- URL: https://github.com/compilorama/statorama
- Owner: compilorama
- Created: 2024-06-14T01:51:27.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-14T02:42:13.000Z (about 2 years ago)
- Last Synced: 2025-06-19T12:05:34.535Z (about 1 year ago)
- Language: JavaScript
- Size: 71.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Statorama
> Analytics wrapper for Umami
[](https://circleci.com/gh/compilorama/statorama/tree/main)
[](https://coveralls.io/github/compilorama/statorama?branch=main)
## 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
``` javascript
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
``` javascript
import statorama from '@compilorama/statorama';
statorama.track(
String, // Event Name (Ex.: 'Button Clicked')
Object // Event Data (Ex.: { name: 'Subscribe' })
)
```
## Contributing
1. Install [Node](https://nodejs.org/en/). Download the "Recommend for Most Users" version.
2. Clone the repo:
``` bash
git clone git@github.com:compilorama/statorama.git
```
3. Go to the project directory:
``` bash
cd statorama
```
4. Install the project dependencies:
``` bash
npm install
```
5. Build the project:
``` bash
npm run build
```
## Tests
Ensure that all code that you have added is covered with unit tests:
``` bash
npm run test -- --coverage
```