SDK reference
Every method on PulseClient, and the config it takes.
pnpm add @thepulseapi/sdkSession
| Method | Returns | |
|---|---|---|
init(config) | TrackResponse | null | Start a session and send the automatic signals once |
getSession() | SessionResponse | Current session and inferred personas |
getSessionId() | string | The current session id |
resetSession() | void | Clear it and start fresh |
onPersona(cb) | void | Subscribe to persona updates |
Signals and ranking
| Method | Returns | |
|---|---|---|
track(signals) | TrackResponse | Send shopper signals |
search(products, options?) | SearchResponse | Rank products you pass in |
rankedCatalog(options?) | RankedCatalogResponse | Rank the catalogue already synced to PULSE |
event(type, data?) | EventResponse | Record a named event |
search and rankedCatalog are not interchangeable. search ranks what you hand it;
rankedCatalog ranks what PULSE already holds.
Exposure
| Method | ||
|---|---|---|
exposure(decisionId, items) | void | Record what was actually rendered, buffered |
flushExposures() | Promise<void> | Send buffered exposures now |
Config
apiKeyRequiredstring
Publishable key, pk_live_...
organizationIdRequiredstring
From the dashboard
endpointOptionalstring
Override only for local development
Defaults to https://api.thepulseapi.com
autoTrackOptionalboolean
Capture device, referrer and time on init()
Defaults to true
sessionTtlMsOptionalnumber
Inactivity before a new session
Defaults to 1800000
anonymousIdOptionalstring
Identity label only. Never reaches inference.
debugOptionalboolean
Verbose logging
Defaults to false

