dobbin-twitch
v0.9.7
Published
Twitch frontend tracking client.
Downloads
70
Maintainers
Readme
Dobbin
Dobbin is a client side tracking library that lets you send events to our internal analytics platform Spade, as well as Mixpanel. You can get help with Dobbin in the #site-performance Slack channel. For Spade questions, visit the #scieng Slack channel.
import { Dobbin, SPADE_SERVICE, MIXPANEL_SERVICE } from 'dobbin';
Dobbin.trackEvent('signup-user', { referrer: 'https://twitch.tv/prime' }, [SPADE_SERVICE, MIXPANEL_SERVICE]);
API
Dobbin.configure({ Promise, useSendBeacon, serviceUrls, serviceBatchSizes, siteOptions })
Promise
: Dobbin doesn't ship with a Promise library to minimize its payload size, so you need to pass in thePromise
object as a config option.useSendBeacon
: Use sendBeacon to send the data if it is available.serviceUrls
: URLs for Spade and Mixpanel, mostly with testing in mind. In the form{spade: {href: <url>}, mixpanel: {href: <url>}}
.serviceBatchSizes
: Maximum batch size for each service, mostly with testing in mind.siteOptions
: the SiteOptions object, which contains the current spade URL in an experiment.
Dobbin.trackEvent(name, data, services);
name
- String - the name of your eventdata
- Object - a hash of properties attached to the eventservices
- Array - (Optional) a list of services that should receive the event. Valid services are"spade"
and"mixpanel"
, default is["spade", "mixpanel"]
.
Development
npm install
- Install dependenciesnpm run build
- Builds the assets.npm run lint
- Runs the linter.npm run test
- Runs tests once.npm run test:watch
- Runs a test server and watches for changes.