brascoder / bighorn

A standardized interface for event tracking

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Bighorn auto-detects backends by checking for their variable names on the global namespace. i.e. window, self

Supported Backends

Note: Bighorn formats structured data as KVN when emitting events to some backends to capture the richest dataset possible.

Basic Usage

<script type="text/javascript" src="/path/to/bighorn.min.js"></script>
<script type="text/javascript">

Bighorn.track({
  name: "click",
  type: "affiliate-link",
  host: "my-site.com/example",
  target: "great-offer.com/example",
  value: 7.50,
  utm_source: "traffic-source"
});

</script>

Validation

Details coming soon...

Advanced Usage

It's possible to validate with additional JSON schemas.

<script type="text/javascript" src="/path/to/bighorn.min.js"></script>
<script type="text/javascript">

// 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, ...);
</script>

Setup

git clone git@github.com:hopsoft/bighorn.git
cd bighorn
npm install

Build

make

Test

npm test
npm start
open http://localhost:8080/test

About

A standardized interface for event tracking

License:MIT License


Languages

Language:JavaScript 99.3%Language:HTML 0.6%Language:Makefile 0.1%