https://github.com/hopsoft/bighorn
A standardized interface for event tracking
https://github.com/hopsoft/bighorn
Last synced: about 1 month ago
JSON representation
A standardized interface for event tracking
- Host: GitHub
- URL: https://github.com/hopsoft/bighorn
- Owner: hopsoft
- License: mit
- Created: 2015-12-10T00:41:45.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-06-21T19:22:19.000Z (over 9 years ago)
- Last Synced: 2024-12-29T20:42:05.882Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 5.81 MB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license.md
Awesome Lists containing this project
README
# Bighorn
A standardized interface for event tracking.
## Overview
Bighorn exposes a simple API for emitting events to multiple backends.
Think of it as a poor man's version of [segment.io](https://segment.com/)Bighorn auto-detects backends by checking for their variable names on the global namespace. i.e. window, self
### Supported Backends
* [Google Analytics](https://developers.google.com/analytics)
* [Piwik](https://developer.piwik.org/)
* [Ahoy](https://github.com/ankane/ahoy)__Note__: Bighorn formats structured data as [KVN](https://github.com/hopsoft/kvn)
when emitting events to some backends to capture the richest dataset possible.## Basic Usage
```html
Bighorn.track({
name: "click",
type: "affiliate-link",
host: "my-site.com/example",
target: "great-offer.com/example",
value: 7.50,
utm_source: "traffic-source"
});```
## Validation
Details coming soon...
## Advanced Usage
It's possible to validate with additional JSON schemas.
```html
// schema to restrict event names
var nameSchema = {
"properties": {
"name": {
"enum": [
"click",
"mouseup"
]
}
}
};var eventData = {
name: "click",
type: "affiliate-link",
host: "my-site.com/example",
target: "great-offer.com/example",
value: 7.50,
utm_source: "traffic-source"
};Bighorn.track(data, nameSchema);
// note: track accepts N-number of additional schemas to validate with
// Bighorn.track(data, nameSchema, otherSchema, extraSchema, ...);```
### Setup
```
git clone git@github.com:hopsoft/bighorn.git
cd bighorn
npm install
```### Build
```sh
make
```### Test
```sh
npm test
``````sh
npm start
open http://localhost:8080/test
```