JavaScript API Reference

Wisdom's client side JavaScript API contains a mix of synchronous and asynchronous methods and properties. Wisdom follows industry convension by use of an asynchronous task queue snippet that asynchronously loads the bulk of Wisdom's JavaScript code. This allows certain methods to be invoked immediately, and they will be run as soon as Wisdom finishes loading. The most common async example is wisdom('init', __PROJECT_ID__, opts).

Async Methods

These methods will run asynchronously after initialization.

Async Methods
wisdom('init', __PROJECT_ID__) // Starts Wisdom. Optionally "configs" object as 3rd param.
wisdom('identify', __IDENTITY_ID__) // Identity the current user with your ID.
wisdom('setUserInfo', {...}) // Sets basic data about the current user. Some restrictions exist.
wisdom('onReady', callback) // Runs callback Wisdom after Wisdom initializes.
wisdom('onFail', callback)
wisdom('bail') // End Wisdom without recording any data.
wisdom('takeCanvasSnapshot', elementOptional) // Records current pixels of all HTML5 canvases on page.
// Optionally accepts a specific canvas element to record.
wisdom('track', eventName, eventData) // Records a custom user event.
wisdom('trackReserved', eventName, eventData) // Records a custom user event.
wisdom('reduxAction', action, prevState, nextState, opts)
wisdom('setActiveCompanyId', companyId) // Sets "activeCompanyId" property on the User.
// companyId must be a String or Integer.

Static Methods

These exist after initialization.

Static Methods
wisdom.getSessionURL() // Returns the URL for viewing this session at the current time.
// Optionally takes a date to reference a point in time.
wisdom.getIdentityId() // Returns the identityId if available.
wisdom.end() // End Wisdom without recording any data.
wisdom.toString() // Returns 'Wisdom: Session Replay.'

Static Properties

These read only properties are safe to use any time.

Static Methods
wisdom.identityId // Returns the identityId if available.
wisdom.projectId // Returns the projectId if available.
wisdom.sessionId // Returns the sessionId if available.
wisdom.isReady // Returns true if Wisdom is currently initialized. // Returns this help message.

For more information on the JS Client API, visit


For those who just want to play around with some code, the following examples are for you.

// Add Wisdom's async script loader and method queue.
!function(W,I,S,D,O,M){"use strict"; if(S.__WISDOM__INIT__OBJECT_REFERENCE=W,!(W in S)){var f=S[W]=function(){arguments.length&&f.q.push({args:arguments,ts:new Date})};
f.ts=new Date,f.q=[]; var g=D.createElement("script");g.src=""+(I|0),g.type="text/javascript",g.charset="UTF-8",g.crossOrigin="anonymous",g.async=!0;
var h=D.getElementsByTagName("script")[0];h.parentNode.insertBefore(g,h)}}("wisdom",1,window,document);
wisdom('init', __YOUR_PROJECT_ID_HERE__);
wisdom('identify', __UNIQUE_USER_IDENTITY_ID_HERE__);
wisdom('setUserInfo', {
firstName: 'John',
lastName: 'Doe',
// Optional onReady callback. Can be called anytime, as many times as desired.
wisdom('onReady', () => { // Wisdom is now running
// Example: """
// Example: ""
wisdom.isReady // true
wisdom.accountId // What you provide, in this case the value of __YOUR_ACOUNT_ID_HERE__
wisdom.identityId // // Prints out help message
wisdom.stop(); // Stops and Clears everything.
wisdom.bail() // Stops, without saving any data.


wisdom('setUserInfo', {
firstName: 'John',
lastName: 'Doe',
email: '',

Reserved Traits

Trait NameTypeDescription
identityIdstringUnique ID in your database for a user
usernameStringThis should be unique to each user, like the usernames of Twitter or GitHub.
avatarURLStringURL to an avatar image for the user
userRoleStringThe application role of a user (Example: "Admin", "Member")
emailStringPhone number of a user
phoneStringEmail address of a user
firstNameStringFirst name of a user
lastNameStringLast name of a user
companyIdsArrayList of Company IDs the user is part of. Example: ['112','113']
planStringCurrent billing plan used by user
totalSpendNumberTotal application spend of a user
birthdayDateDate of birth of the user
firstSeenDateDate the user was first seen
registeredAtDateDate the user’s account was first created

Complete Configuration Reference

In addition to the lengthly JavaScript snippet below, you can view the configurations for a particular project, in your geographic area by pluggin in your projectId to the following URL:

Example: All together now
wisdom('init', __PROJECT_ID__, {
debug: false,
buildHash: 'v2.7.3__70789fb021036ecc', // example
ingestionServer: '',
featureFlags: false,
sanitizers: {
replaceText: [funcs, funcs], // Function Signature: (str, element, isCensored)
replaceValue: [funcs, funcs], // Function Signature: (str, element, isCensored)
censorElement: [funcs, funcs], // Function Signature: (element)
censorStorageVal: [funcs, funcs], // Function Signature: ([key, val])
url: [funcs, funcs], // Function Signature: (urlStr)
network: [funcs, funcs], // Function Signature: ({reqObj, resObj})
reduxState: [funcs, funcs], // Function Signature: (stateObj)
reduxAction: [funcs, funcs], // Function Signature: (actionObj)
main: {
master: true,
trafficLoad: 100,
crossDomainIdentity: {
enabled: false,
origins: [],
clientIntegrity: {
enabled: false,
ipBlocking: {
enabled: false,
integrations: {
segment: true,
intercom: true,
googleAnalytics: true,
userVoice: true,
heap: true,
mixpanel: true,
wootric: true,
bugsnag: true,
trackjs: true,
sentry: true,
rollbar: true,
drift: true,
liveChat: true,
qualaroo: true,
olark: true,
errorception: true,
recorders: {
html: true,
mouseTouch: true,
inputs: true,
performance: false,
errors: true,
browserTracking: false,
textSelection: true,
tabVisibility: true,
hoverRecorder: true,
canvas: false,
customEvents: true,
console: true,
extensions: false,
clipboard: true,
storage: true,
geolocation: false,
redux: true,
fetch: false,
xhr: false,
stats: true,
censorship: {
cssSelectors: {
enabled: true,
selectors: ['input[type="password"]'],
urlParams: {
enabled: true,
params: ['auth_token'],
Last updated on by John Gracey