Full Installation Guide

Extended Installation Concepts:

ConceptsDescription
User TraitsAdd all special user traits to Wisdom to help you sort through your key users.
Redux TrackingTrack low level application state changes powered with redux stores.
Deployment TrackingTrack all application deployments- ensuring successful releases.
Custom SanitizersTake full control with low level function hooks to intercept what gets recorded.
Tracking EventsPush custom event tracking into Wisdom to easily replay key actions and behaviors.
Client VerificationPrevent identity spoofing using an integrity secrets generated by SHA256 HMAC hashing.
Feature FlagsSet certain feature flags for particular companies.


You may also find it helpful to review the Complete Configuration Reference.


Redux Tracking

Wisdom supports logging Redux actions.

wisdom('reduxAction', action, prevState, nextState, {duration});

Add Wisdom's logger middleware to capture relevant context. Besure to keep Wisdom's logger as the very last middleware.

Custom Events
const wisdomReduxLogger = store => next => action => {
const prevState = store.getState();
const start = (performance || Date).now();
const newAction = next(action);
const end = (performance || Date).now();
const nextState = store.getState();
const duration = end - start;
try {
if (window.wisdom) {
window.wisdom('reduxAction', action, prevState, nextState, {duration});
}
} catch (ex) {
console.error("[WISDOM Redux Logger]:", ex);
} finally {
return newAction;
}
}
const middleware = [applyMiddleware(
...commonMiddleware,
...envMiddleware,
sagaMiddleware,
wisdomReduxLogger, // <---- Note Wisdom logger is last !!!
)];

Deployment Tracking

Sanitizer Functions
wisdom('init', __PROJECT_ID__, {
buildHash, 'v2.7.3__70789fb021036ecc',
});

Custom Sanitizers

Check out the full Censorship section on Sanitizers.

Sanitizer Functions
const 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)
};
wisdom('init', 7, {
sanitizers,
});

User Traits

`

Sanitizer Functions
wisdom('setUserInfo', {
// Optional, but highly recommended.
email: __EMAIL_OF_YOUR_USER_HERE, // eg. john@example.com
firstName: __FIRST_NAME_OF_YOUR_USER_HERE, // eg. John
lastName: __LAST_NAME_OF_YOUR_USER_HERE, // eg. Smith
phone: __TELEPHONE_OF_YOUR_USER_HERE, // eg. 650-123-4567
companyIds: [...__COMPANY_IDS_HERE__], // eg. [100, 202, 'a4e71']
activeCompanyId: __COMPANY_ID__, // The company currently being tracked.
traits: { /* Custom Key-Value pairs here. */ },
});
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

Tracking Events

You can provide custom events to Wisdom to track. For example, Wisdom's PDF recorder tracks downloads and text searches.

Sanitizer Functions
// Tracking Custom Events:
wisdom('track', 'YOUR_EVENT_NAME', {
hello: 'World',
youCanAdd: 'AnyInfoYouWant',
});
// Tracking Specially Reserved Events built into Wisdom
wisdom('trackReserved', 'SEARCH__QUERY', {
query: 'Which queries are valid?',
name: 'MAIN_SEARCH_BAR_v2',
});
/**
* RESERVED EVENTS LIST. Certain params allowed.
*/
// AUTH
wisdom('trackReserved', 'AUTH__REGISTRATION__SUCCESS');
wisdom('trackReserved', 'AUTH__REGISTRATION__FAIL');
wisdom('trackReserved', 'AUTH__PRE_REGISTRATION__SUCCESS');
wisdom('trackReserved', 'AUTH__PRE_REGISTRATION__FAIL');
wisdom('trackReserved', 'AUTH__LOGIN__SUCCESS');
wisdom('trackReserved', 'AUTH__LOGIN__FAIL');
wisdom('trackReserved', 'AUTH__LOGOUT_SUCCESS');
wisdom('trackReserved', 'AUTH__LOGOUT_FAIL');
wisdom('trackReserved', 'AUTH__FORGOT_PASSWORD__SUCCESS');
wisdom('trackReserved', 'AUTH__FORGOT_PASSWORD__FAIL');
wisdom('trackReserved', 'AUTH__PASSWORD_RESET__SUCCESS');
wisdom('trackReserved', 'AUTH__PASSWORD_RESET__FAIL');
// USERS & PROFILES
wisdom('trackReserved', 'APP__USER__INVITE', {email, identityId});
wisdom('trackReserved', 'APP__USER__REMOVE', {email, identityId});
wisdom('trackReserved', 'APP__PROFILE__UPDATE');
// ORGANIZATION MANAGEMENT
wisdom('trackReserved', 'APP__PROJECT__CREATE', {name, url});
wisdom('trackReserved', 'APP__PROJECT__UPDATE', {name, url});
wisdom('trackReserved', 'APP__PROJECT__DELETE', {name, url});
// PROJECT MANAGEMENT
wisdom('trackReserved', 'APP__ORGANIZATION__CREATE', {name, url});
wisdom('trackReserved', 'APP__ORGANIZATION__UPDATE', {name, url});
wisdom('trackReserved', 'APP__ORGANIZATION__DELETE', {name, url});
// APP STATUS
wisdom('trackReserved', 'APP__CRASH');
wisdom('trackReserved', 'APP__404');
wisdom('trackReserved', 'APP__401');
// ECOMMERCE
wisdom('trackReserved', 'ECOMMERCE__CART__ADD', {title, url});
wisdom('trackReserved', 'ECOMMERCE__CART__REMOVE', {title, url});
wisdom('trackReserved', 'ECOMMERCE__CART__PURCHASE', {total});
wisdom('trackReserved', 'ECOMMERCE__CART__ABANDON');
// MISC
wisdom('trackReserved', 'SEARCH__QUERY': {query, name});
wisdom('trackReserved', 'FEEDBACK', {score, comment, nps});
wisdom('trackReserved', 'DOWNLOAD', {title, url});
wisdom('trackReserved', 'SUPPORT__REQUEST__START');

Client Verification (Integrity Hashing)

Identity Verification works by assigning a client integriy secret that is shared privately between your server's and Wisdom's. The secret value shall be used within the SHA256 HMAC hashing algorithm.

NOTE: Identity verification is only available for use with users who have been assigned a unique identity- unidentified users won't be verified.

Custom Events
const crypto = require('crypto');
const CONFIG = require('../../config.js');
exports.getUser = (req, res, next) => {
const user = loadUserMagicallySync();
const hmac = crypto.createHmac('sha256', CONFIG.WISDOM.CLIENT_INTEGRITY_SECRET);
hmac.update(user.email);
user.userIntegrity = hmac.digest('hex');
return res.json(user);
}

Feature Flags

You can create and set new feature flags within the web application on the feature flag config page. Feature flags are set on a per company basis, so in general, you'll want to setup company tracking first.

Custom Events
const newFeature = wisdom.flag('enhanced_tracking_configs');
if (wisdom.flag('alpha_features')) {
// Do feature thing...
}
if (wisdom.flag('beta_features') !== false) {
// Do feature thing...
}
Last updated on by John Gracey