Appearance
API reference
The SDK exports these functions. In the script tag build they live on window.JustOneCX.
| Function | Purpose |
|---|---|
init(options) | Start the SDK. Fetches and shows published content. |
identify(userId, traits?, options?) | Set who the current user is. |
group(accountId, traits?, options?) | Set the account the user belongs to. |
track(eventName, properties?) | Record a custom event. |
reset(options?) | Clear identity on sign-out. |
startTour(tourId) | Replay a tour on demand. |
Rules for all calls
- Run
init()first.identify,group,trackandstartTourcalled beforeinit()log a console error and do nothing. They never throw. - Every call is best effort. A failed network request never throws and never blocks your page.
- Traits are plain objects of strings, numbers and booleans.
Types
ts
interface InitOptions {
publicKey: string;
apiUrl?: string;
disableChat?: boolean;
trackRouteChanges?: boolean;
}Traits is a flat key/value object. Import it from the package: import type { Traits } from "@justonecx/sdk".