reddit/event-tracker

Name: event-tracker

Owner: Reddit

Description: null

Created: 2015-10-14 18:11:40.0

Updated: 2018-04-12 01:17:30.0

Pushed: 2018-04-12 01:17:29.0

Homepage: null

Size: 45

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Behold, the Event Tracker

Build Status

Usage:

ey, secret, clientName, and endpoint can also be configured via the environment
ariables TRACKER_KEY, TRACKER_SECRET, TRACKER_CLIENT_NAME and TRACKER_ENDPOINT.

tracker = new EventTracker({
y: 'MyApp01',
cret: 'abcdef==',
stData: jQuery.post, // function to use for ajax: `post(url, data)`
lculateHash: createHmac, // A function that takes (key, string) and returns an HMAC
dpoint: 'https://events-test.redditmedia.com/v1', // collector endpoint
ientName: 'desktopWeb', // client name, prepended to event type in payload
pendClientContext: true, // automatically adds user_agent, path, and domain to payload
fferTimeout: 100, // flush buffer of events after 100ms
fferLength: 40, // flush buffer events after buffer length is 40
bug: true, // log events instead of sending them.


ker.track('mod_events', 'ban', {
er_name: 'allthefoxes',
er_id: 't2_8aioi',
_name: 'noadmins',
_id: 't5_2xakt',
tails_text: 'reason: being an admin',
rget_id: 't2_3bzrh',
rget_name: 'ajacksified',
rget_type: 'user',
efaults);

end immediately rather than buffering. Without calling `send()`, the event
ill be sent after buffer timeout (100ms) or buffer max length (40) is
eached. `send` flushes the current buffer of events and resets the timer.
end optionally takes a callback.
ker.send(callback);
Testing
Using It

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.