# candu-client

> Candu javascript library

Latest version **0.1.0** (published 2019-03-13) · MIT license · 0 weekly downloads

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

## Install

```sh
npm install candu-client
pnpm add candu-client
yarn add candu-client
bun add candu-client
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2019-03-13 |
| First published | 2018-12-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=5 |
| Dependencies | 4 |
| Unpacked size | 408.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Michele Riccardo Esposito |
| Maintainers | candulabs |

## Links

- npm: https://www.npmjs.com/package/candu-client
- Repository: https://github.com/candulabs/js-client
- Homepage: https://github.com/candulabs/js-client#readme
- Issues: https://github.com/candulabs/js-client/issues
- npm.io page: https://npm.io/package/candu-client

## Dependencies (4)

- [eventing](https://npm.io/package/eventing.md) github:candulabs/js-eventing
- [lodash.get](https://npm.io/package/lodash.get.md) ^4.4.2
- [lodash.pick](https://npm.io/package/lodash.pick.md) ^4.4.0
- [lodash.isempty](https://npm.io/package/lodash.isempty.md) ^4.4.0

## Recent versions

- 0.1.0 (latest) — 2019-03-13
- 0.0.8 — 2019-01-23
- 0.0.7 — 2019-01-21
- 0.0.6 — 2019-01-21
- 0.0.4 — 2019-01-15
- 0.0.3 — 2019-01-13
- 0.0.2 — 2019-01-07
- 0.0.1 — 2018-12-04

## README

# Candu JS Client

Best in-app learning experience.

## Installation

### Node.js
Install it using node or yarn
`npm install --save candu-client`
or with yarn if you prefer
`yarn add candu-client`

## Usage

The SDK is made of three functions:
* Init
* Identify
* Track

`Init` is used to create a singleton object of the client. We discourage re-initializing the client every time, as it risks creating less efficient memory management and race conditions. After initializing the client, you’ll be able to use the `identify`  and `track` functions.

### Initiation

To get started, just run create a new client

```const client = new Candu.Client({ clientToken: '<MY_CLIENT_TOKEN>', userId: '<USER_ID>' })```.

In order to obtain a test token, please contact us at [support@candu.ai](mailto:support@candu.ai).

### Identify

Identify is used to record the identity of a client. The Identify call is fundamental to receive the videos that a customer should get, as well as updating his information. You should do an identify call everytime you load a page since this call will download and refresh the result list.

```client.identify(userId[, traits ])```

`userId` is the user identifier that you want to track. This identifier will be stored in order to be used again for the track calls. `traits` is an object containing all the user properties you want to record about the user.


### Tracking an event

Tracking events is easy.

```js
candu.track(eventName [, properties])
```

The function `track` takes the following parameters:

<table>
  <tr>
    <th>Parameter name</th>
    <th>Description</th>
  </tr>
  <tr>
    <td>eventName</td>
    <td>
      The name of the event you want to track.
    </td>
  </tr>
  <tr>
    <td>properties</td>
    <td>
      Any additional properties you want to track.
    </td>
  </tr>
</table>

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