Full Installation Guide
Extended Installation Concepts:
| Concepts | Description |
|---|---|
| User Traits | Add all special user traits to Wisdom to help you sort through your key users. |
| Redux Tracking | Track low level application state changes powered with redux stores. |
| Deployment Tracking | Track all application deployments- ensuring successful releases. |
| Custom Sanitizers | Take full control with low level function hooks to intercept what gets recorded. |
| Tracking Events | Push custom event tracking into Wisdom to easily replay key actions and behaviors. |
| Client Verification | Prevent identity spoofing using an integrity secrets generated by SHA256 HMAC hashing. |
| Feature Flags | Set 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.
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
wisdom('init', __PROJECT_ID__, {buildHash, 'v2.7.3__70789fb021036ecc',});
Custom Sanitizers
Check out the full Censorship section on Sanitizers.
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
`
wisdom('setUserInfo', {// Optional, but highly recommended.email: __EMAIL_OF_YOUR_USER_HERE, // eg. john@example.comfirstName: __FIRST_NAME_OF_YOUR_USER_HERE, // eg. JohnlastName: __LAST_NAME_OF_YOUR_USER_HERE, // eg. Smithphone: __TELEPHONE_OF_YOUR_USER_HERE, // eg. 650-123-4567companyIds: [...__COMPANY_IDS_HERE__], // eg. [100, 202, 'a4e71']activeCompanyId: __COMPANY_ID__, // The company currently being tracked.traits: { /* Custom Key-Value pairs here. */ },});
| Trait Name | Type | Description |
|---|---|---|
identityId | string | Unique ID in your database for a user |
username | String | This should be unique to each user, like the usernames of Twitter or GitHub. |
avatarURL | String | URL to an avatar image for the user |
userRole | String | The application role of a user (Example: "Admin", "Member") |
email | String | Phone number of a user |
phone | String | Email address of a user |
firstName | String | First name of a user |
lastName | String | Last name of a user |
companyIds | Array | List of Company IDs the user is part of. Example: ['112','113'] |
plan | String | Current billing plan used by user |
totalSpend | Number | Total application spend of a user |
birthday | Date | Date of birth of the user |
firstSeen | Date | Date the user was first seen |
registeredAt | Date | Date 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.
// Tracking Custom Events:wisdom('track', 'YOUR_EVENT_NAME', {hello: 'World',youCanAdd: 'AnyInfoYouWant',});// Tracking Specially Reserved Events built into Wisdomwisdom('trackReserved', 'SEARCH__QUERY', {query: 'Which queries are valid?',name: 'MAIN_SEARCH_BAR_v2',});/*** RESERVED EVENTS LIST. Certain params allowed.*/// AUTHwisdom('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 & PROFILESwisdom('trackReserved', 'APP__USER__INVITE', {email, identityId});wisdom('trackReserved', 'APP__USER__REMOVE', {email, identityId});wisdom('trackReserved', 'APP__PROFILE__UPDATE');// ORGANIZATION MANAGEMENTwisdom('trackReserved', 'APP__PROJECT__CREATE', {name, url});wisdom('trackReserved', 'APP__PROJECT__UPDATE', {name, url});wisdom('trackReserved', 'APP__PROJECT__DELETE', {name, url});// PROJECT MANAGEMENTwisdom('trackReserved', 'APP__ORGANIZATION__CREATE', {name, url});wisdom('trackReserved', 'APP__ORGANIZATION__UPDATE', {name, url});wisdom('trackReserved', 'APP__ORGANIZATION__DELETE', {name, url});// APP STATUSwisdom('trackReserved', 'APP__CRASH');wisdom('trackReserved', 'APP__404');wisdom('trackReserved', 'APP__401');// ECOMMERCEwisdom('trackReserved', 'ECOMMERCE__CART__ADD', {title, url});wisdom('trackReserved', 'ECOMMERCE__CART__REMOVE', {title, url});wisdom('trackReserved', 'ECOMMERCE__CART__PURCHASE', {total});wisdom('trackReserved', 'ECOMMERCE__CART__ABANDON');// MISCwisdom('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.
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.
const newFeature = wisdom.flag('enhanced_tracking_configs');if (wisdom.flag('alpha_features')) {// Do feature thing...}if (wisdom.flag('beta_features') !== false) {// Do feature thing...}