# sandbox-insights

> SandBox Insights Node Package

Latest version **1.1.0** (published 2017-08-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install sandbox-insights
pnpm add sandbox-insights
yarn add sandbox-insights
bun add sandbox-insights
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-08-03 |
| First published | 2017-07-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= v0.10.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | SandBox Commerce |
| Maintainers | zyphxion |

## Links

- npm: https://www.npmjs.com/package/sandbox-insights
- Repository: https://github.com/SandBoxApps/sandbox-insights
- Homepage: https://github.com/SandBoxApps/sandbox-insights#readme
- Issues: https://github.com/SandBoxApps/sandbox-insights/issues
- npm.io page: https://npm.io/package/sandbox-insights

## Recent versions

- 1.1.0 (latest) — 2017-08-03
- 1.0.8 — 2017-08-02
- 1.0.7 — 2017-08-02
- 1.0.6 — 2017-08-02
- 1.0.5 — 2017-08-02
- 1.0.4 — 2017-08-02
- 1.0.3 — 2017-08-02
- 1.0.2 — 2017-08-01
- 1.0.1 — 2017-07-31
- 1.0.0 — 2017-07-28

## README

# sandbox-insights
This is the public node package repository for the Insights project

## Installation

Install the package with:

    npm install sandbox-insights --save

## Usage

The package needs to be initialized with your app's App Key which you can find on your SandBox Insights App Management page. Require it with the key's value:

``` js
var SBInsights = require('sandbox-insights')('...your app key...');
```

On ES6, this would look like:

``` js
import sbInsightsPackage from 'sandbox-insights';
const SBInsights = sbInsightsPackage('...your app key...');
```

### Recording Events

To track events, use the module like this:

``` js
SBInsights.recordEvent('eventCategory', 'actionName');
```

### Recording Page Views

To track page views, use the module like this:

``` js
SBInsights.recordPageView('pageName');
```

### Recording Users and User Data

``` js
// to record the start of a user session, call this function and pass along a unique identifier for the user
SBInsights.recordUser('identifier');

// to record and update the user's data, call this function once you've started the user's session
SBInsights.updateUser('identifier', 'data type', 'value');

// the currently supported data types are:
//   'email'
//   'locale'
//   'firstName'
//   'lastName'
//   'platform'
//   'versionNumber'
```

### More functionality coming soon

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