Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

candu-client

candulabs16MITdeprecated0.1.0

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

Candu javascript library

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.

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.

candu.track(eventName [, properties])

The function track takes the following parameters:

Parameter name Description
eventName The name of the event you want to track.
properties Any additional properties you want to track.

changelog

Changelog

All the notable changes and version packaging for Candu-client

0.1.x

0.1.0 - 13/03/2019

  • Major release that greatly simplifies the candu client. In this release, we extracted all the eventing and switched it to using the new LMS platform instead of the player.

0.0.x

0.0.8 - 23/01/2019

  • Fix BTOA encoding bug for characters outside Latin1

0.0.7 - 21/01/2019

  • fix bundling bug

0.0.6 - 21/01/2019

  • Improve self-initalization logic

0.0.5 - 20/01/2019

  • Load the CanduPlayer asyncronously to be able to update it on the fly
  • Reduce bundle size and eliminate code we don't need anymore since it's on the server

0.0.4 - 15/01/2019

  • Return promise on identify
  • Improve webpack setup with redux

0.0.3

  • Switch internal storage to Redux
  • Add debounce event and page

0.0.2

Restyle player

0.0.1

First public version of Candu-client. Included functionalities are:

  • Event tracking:
    • identify