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]);
-
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.
-
name
- String - the name of your event -
data
- Object - a hash of properties attached to the event -
services
- Array - (Optional) a list of services that should receive the event. Valid services are"spade"
and"mixpanel"
, default is["spade", "mixpanel"]
.
-
npm install
- Install dependencies -
npm 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.