# heap-server

> Heap Analytics server-side events helper

Latest version **1.0.2** (published 2015-11-19) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install heap-server
pnpm add heap-server
yarn add heap-server
bun add heap-server
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2015-11-19 |
| First published | 2014-07-28 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Anthony Ringoet |
| Maintainers | anthonyringoet |

## Links

- npm: https://www.npmjs.com/package/heap-server
- Repository: https://github.com/anthonyringoet/heap-server
- Issues: https://github.com/anthonyringoet/heap-server/issues
- npm.io page: https://npm.io/package/heap-server

## Dependencies (2)

- [xtend](https://npm.io/package/xtend.md) ^3.0.0
- [request](https://npm.io/package/request.md) ^2.39.0

## Recent versions

- 1.0.2 (latest) — 2015-11-19
- 1.0.1 — 2014-09-03
- 1.0.0 — 2014-09-03
- 0.0.1 — 2014-07-28

## README

# Heap server-side events [![Build Status](https://secure.travis-ci.org/anthonyringoet/heap-server.png?branch=master)](http://travis-ci.org/anthonyringoet/heap-server)

Heap Analytics server-side events helper

## Getting Started
Install the module with: `npm install heap-server`

More info on the [Heap documentation site](https://heapanalytics.com/docs/server-side)

## Methods
The Heap server side API currently has two internal methods:

- ```track```
- ```identify```

When you send along an ```event``` property with the ```heap.push()``` method you will be using the internal ```track``` method. If you are not sending an event along you're using the internal ```identify``` method.

#### Example: tracking a custom event

```javascript
var heap = require('heap-server')('--your-heap-app-id--');

heap.push({
  identity: "john@doe.org",
  event: "Custom event name that shows up in Heap Analytics",
  properties: { // extra event properties are optional
    "foo" : "bar"
  }
}, function(err, foo){
  if(err){
    return;
  }
  console.log(foo);
});

// or no callback

heap.push({
  identity: "john@doe.org",
  event: "Custom event name that shows up in Heap Analytics",
  properties: {
    "foo" : "bar"
  }
});
```

#### Example: identifying a new or existing user

You can also use this to update properties for an existing user.

```javascript
var heap = require('heap-server')('--your-heap-app-id--');

heap.push({
  identity: 'john@doe.orgfoobar',
  properties: {
    'foo': 'bar',
    'random': 'bogus'
  }
},
function(err, result){
    if(err){
      return;
    }
    console.log(result);
});


// or no callback

heap.push({
  identity: 'john@doe.orgfoobar',
  properties: {
    'foo': 'bar',
    'random': 'bogus'
  }
});

```

---
_Source: https://npm.io/package/heap-server · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
