A node.js API for mixpanel
track_batch
uses the track endpoint to record multiple events at once. These events must be more recent than 5 days old; for older events, use the existing import_batch
method.mixpanel.track_batch([
{event: 'event 1', properties: {color: 'blue'}},
{event: 'event 2'},
]);
HTTPS_PROXY
or HTTP_PROXY
; if present, the library will route requests through the proxy.This allows you to specify the time
property of an event when calling mixpanel.track()
and still hit the /track
endpoint (meaning that you only need the project's publishable Mixpanel token, not its private API key).
This update comes with one minor breaking change: mixpanel.track()
used to choose automatically between the /import
and /track
endpoints based on the presence or absence of the time
property. Now it will always hit /track
, and will throw an exception if the time is out of bounds (more than 5 days ago). For older events, of course, you can continue to use mixpanel.import()
.
Support for optionally sending all requests over https. Initialize the lib with:
mixpanel.init('MY_TOKEN', {protocol: 'https'});
In the future (after v1.0.0), https will become the default protocol.
To support deleting people profiles without resolving aliases. Call like:
mixpanel.people.delete_user('billybob', {$ignore_alias: true});
Provides a mechanism for specifying optional modifier params $ignore_time
, $ip
, and $time
across all mixpanel.people
calls. For example:
// don't update $last_seen property
mixpanel.people.increment("billybob", "games_played", {$ignore_time: true});
Override host for mixpanel requests (for dev/testing/etc) with init option:
mixpanel.init(token, {host: 'example.com:1337'});
people.union()
merges a given list or value with a list-valued people analytics property, excluding duplicate values.
import_batch()
sends a list of events to Mixpanel using the import endpoint.