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:
- Web Browser (you could also use
@livelike/engagementsdk
instead) - Node.js (server side JS runtime technology)
- Electron.js (client side technology to develop Desktop Application)
- 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
clientId
Type | Default |
---|---|
String (Required) | No Default |
accessToken
accessToken
Type | Default |
---|---|
String | No Default |
logger
logger
Type | Default |
---|---|
boolean | false |
nickName
nickName
Type | Default |
---|---|
String | If not provided, nickname will be randomly generated for the new profiles |
storageStrategy
storageStrategy
Type | Default |
---|---|
IStorageStrategy | localStorage |
publishKey
publishKey
Type | Default |
---|---|
String | No Default |
endpoint
endpoint
Type | Default |
---|---|
String | https://cf-blast.livelikecdn.com/api/v1/ |
analyticsProvider
analyticsProvider
Type | Default |
---|---|
IAnalyticsProvider | No 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.
Updated about 1 year ago