Getting started

How to get started with the Javascript SDK

LiveLike Javascript SDK is an isomorphic package that could be used in any JS runtime environment allowing integrators to enhance user experiences with chat and other features to increase user engagement. JS runtime could be:

  1. Web Browser (you could also use @livelike/engagementsdk instead)
  2. Node.js (server side JS runtime technology)
  3. Electron.js (client side technology to develop Desktop Application)
  4. React Native (client side technology to develop native IOS and Android Mobile Application)

Installing

The Javascript SDK can be installed with npm or Yarn. For more details see the NPM package.

npm i @livelike/javascript
yarn add @livelike/javascript

Initialize the SDK with the LiveLike.init function. A Client ID is required to be passed as the clientId property of the function's object argument.

📘

Make sure you have a valid Client ID

You'll need a Client ID for this step, which you learn how to do in Retrieving Important Keys.

import { init } from "@livelike/javascript";

import { clientId } from './your-config'
 
init({ clientId }).then(profile => {
  // This will generate a new profile
  console.log("LiveLike is connected!")
});

Init Argument Details

clientId

TypeDefault
String (Required)No Default

accessToken

TypeDefault
StringNo Default

logger

TypeDefault
booleanfalse

nickName

TypeDefault
StringIf not provided, nickname will be randomly generated for the new profiles

storageStrategy

TypeDefault
IStorageStrategylocalStorage

publishKey

TypeDefault
StringNo Default

endpoint

analyticsProvider

TypeDefault
IAnalyticsProviderNo Default

📘

API reference

Browse our API reference in case you need to understand API params return data types, API usages, object properties, etc.

🚧

User Profile Integration

The init function will create a new LiveLike profile and access token by default, and each profile created counts toward a monthly active user count. You should re-use the access tokens when you can to treat returning visitors as the same user. To better integrate this into your own product and more accurately reflect your MAUs, check out the User Profile Integration section.