Heap Server-Side API Client for Node.js
This package is tested on node.js 0.10 and above.
Install using npm.
npm install email@example.com --save
Create an API client.
var heap = 'YOUR_APP_ID';
Recommended Usage Patterns
Track a server-side event in a fire-and-forget fashion.
Set up an event listener to log Heap API call failures.
Track a server-side event.
Track a server-side event with properties.
Add properties to a user.
The methods described above return
The promises can be safely ignored.
track is a good candidate for
Alternatively, the promises can be used to learn when an API call completes or fails.
On node.js 0.10 and below, you must either explicitly configure a Promise library, or install a polyfill such as es6-promises, as shown below.
In some testing environments, connecting to outside servers is undesirable. Set
stubbed property to
true to have all API calls succeed without
generating any network traffic.
Alternatively, pass the
stubbed option when creating the API client.
var heap = 'YOUR_APP_ID' stubbed: true ;
After cloning the repository, install the dependencies.
Make sure the tests pass after making a change.
When adding new functionality, make sure it has good test coverage.
npm run cov
When adding new functionality, also make sure that the documentation looks reasonable.
npm run doc
Copyright (c) 2016 Heap Inc., released under the MIT license.