server side library for skycap tracking server
A simple client to send requests to a skycap server. Meant to for tracking stuff on the server side and sending into skydb. This is pretty much taken byte for byte from skycap's client side js with minor modifications for making it node-y.
Very much WIP and lots to fix/finalise/do, namely:
- add cli/repl
- write tests
- tidy up client
Known to work with skycap/skydb v2.3
None yet, but Works On My Machine verified
Stability: 1 Experimental
The API and code are likely to change/evolve as the skydb and skycap themselves change.
npm install skycap-client
Pretty much like the original skycap client, see the examples below.
Returns a new instance of a
options has to be an object and only notices one key,
host, whose value should be the URL of the skycap server to send the tracking data to.
###client.identify(identifier, [data]) This method identifies a user and associates user-level state with them. For example, you may want to identify the user by an email address or id from your datastore.
data object represents state about the user itself. This could be their name or whether they are a paid user. User-level data is data that changes over time and exists outside the context of an action the user is performing.
###client.track(action, [data], [callback]) This method tracks a specific action that has occurred. This could be the web page that the user is on or it could be a link that is clicked.
The first argument is the name of the action. The second argument is action-level data. Action-level data is any data that exists only within the context of this specific action. For example, a
purchase action could have
purchase_amount. An optional
callback function may be supplied which gets 1 arguments,
err, in the event of their being an error making the tracking call
var skycap = requireskycap-client;var options = host: ""var client = skycapcreateClientoptions;clientidentify'user-101' entryPoint:'web' accId:'8172635';clienttrack'did stuff' thing: 'some-value' callback;clienttrack'purchase' amount: 1256 callback;clienttrack'beep-boop' volume: 11 callback;