Skip to main content

Session Variables

These variables must be set in your req.session object to enable https://mintcdn.com/dangowebsolutions/aopwfvJagnjWqHdm/icons/commtrackr/commtrackr.svg?fit=max&auto=format&n=aopwfvJagnjWqHdm&q=85&s=507bfef28b9b040d0cb6e3c1a5a013e8https://mintcdn.com/dangowebsolutions/aopwfvJagnjWqHdm/icons/commtrackr/commtrackr-dark.svg?fit=max&auto=format&n=aopwfvJagnjWqHdm&q=85&s=7ccff59f6dc9d18bc140616edd9ec6be CommTrackr functionality. Alternatively, you can modify the variable names to match your custom session configuration using the vars configuration during initialization.
VariablePurposeDefault KeyExample
userIdUnique identifier for the logged‑in userusernamereq.session.username = 'john123'
userNameDisplay name (fallback to userId)namereq.session.name = 'John Doe'
roleUser role (admin, dev, user)rolereq.session.role = 'admin'
roleAliasesMap custom role names to standard ones{}{ user: ['client'], admin: ['owner'] }
accessNumeric access levels alternative to role{}{ var: 'access', admin: [2] }
commissionsArray of commission objects for the usercommissionsSee Commission Object
usersList of all system users (for assignment)users[{ userId: 'dev1', role: 'dev' }, ...]
possibleStatusesAllowed status values[][{ label: 'Pending', value: 'Pending' }]
disableFieldEditingField IDs that admins cannot edit[]['amount', 'currency']

Commission Object

{
  id: 'unique-commission-id', // Unique identifier for the commission
  user: 'userId', // Commission creator's unique userId. Should match the userId variable, otherwise the commission will only be accessible in admin/dev views
  amount: 1000, // Commission amount as a number, or null if not applicable. Defaults to null
  currency: 'USD', // Currency code for the commission amount as a string. Defaults to 'USD'
  date: '2023-10-01', // Date of the commission in any valid date/datetime format. Defaults to null
  status: 'On Hold', // Status of the commission as a string (e.g., 'Completed', 'In Progress', 'On Hold', 'Cancelled')
  fields: { // Custom fields associated with the commission
    'id': 'value' // Key-value pairs for custom fields
  },
  tasks: [ // Array of tasks associated with the commission
    {
      done: false, // Task completion status. Defaults to false
      content: '' // Task description. Defaults to ''
    }
  ],
  locked: false, // Whether commission is locked from being edited by user. Defaults to false
  links: [ // Array of links associated with the commission
    {
      label: 'Link Label', // Link label
      url: 'http://example.com' // Link URL
    }
  ],
  assignedTo: ['dev1UserId', 'dev2UserId'] // Array of userIds of the developers assigned to this commission
}

Custom Text

The tenant customText configuration allows you to override default text strings used throughout the https://mintcdn.com/dangowebsolutions/aopwfvJagnjWqHdm/icons/commtrackr/commtrackr.svg?fit=max&auto=format&n=aopwfvJagnjWqHdm&q=85&s=507bfef28b9b040d0cb6e3c1a5a013e8https://mintcdn.com/dangowebsolutions/aopwfvJagnjWqHdm/icons/commtrackr/commtrackr-dark.svg?fit=max&auto=format&n=aopwfvJagnjWqHdm&q=85&s=7ccff59f6dc9d18bc140616edd9ec6be CommTrackr interface. This is useful for localization or customizing the user experience. Override any UI string by providing a customText object in the tenant configuration:
{
  "userWelcomeBefore": "Welcome, ",
  "userWelcomeAfter": "!",
  "activationTitle": "Activation",
  "sessionTitle": "Session",
  "tenantTitle": "Configuration",
  "authTitle": "Authentication Required",
  "authDescriptionBefore": "You'll need to log into your ",
  "authDescriptionAfter": " account before managing your commissions.",
  "authContinueLabel": "Continue",
  "adminTitle": "Commission Management",
  "adminDescription": "Manage commissions created on your platform.",
  "devTitle": "Commission Management",
  "devDescription": "Manage commissions assigned to you.",
  "userTitle": "Commissions",
  "userDescription": "View and manage your past commissions.",
  "newCommissionTitle": "New Commission",
  "newTaskLabel": "New Task",
  "notFoundTitle": "Not Found",
  "forbiddenTitle": "Forbidden",
  "forbiddenMessage": "You do not have permission to edit this commission.",
  "errorTitle": "Error",
  "errorMessage": "An unexpected error occurred. Please try again later.",
  "labelStatus": "Status",
  "labelStatusDescription": "Required: Commission status.",
  "labelOwner": "Owner",
  "labelOwnerDescription": "Required: Commission owner.",
  "labelAmount": "Amount",
  "labelAmountDescription": "Optional: Commission amount.",
  "labelDate": "Date",
  "labelDateDescription": "Optional: Commission creation date.",
  "labelAssignedTo": "Assigned To",
  "labelAssignedToDescription": "Optional: The developer to assign this commission to.",
  "labelCurrency": "Currency",
  "labelCurrencyDescription": "Optional: Commission currency.",
  "labelLocked": "Locked",
  "labelLockedDescription": "Optional: Whether or not the commission is locked from user editing.",
  "labelTasks": "Tasks",
  "labelSendEmail": "Send Email",
  "labelSendEmailDescription": "Optional: Send an email to the user regarding this update.",
  "labelRequired": "Required",
  "labelOptional": "Optional",
  "youLabel": "(you)",
  "noneLabel": "None",
  "backLabel": "Back",
  "backLabelWithArrow": "← Back",
  "nextLabel": "Next",
  "startLabel": "Start",
  "createLabel": "Create",
  "returnLabel": "Return",
  "restartLabel": "Restart",
  "saveLabel": "Save",
  "syncLabel": "Sync",
  "backToLabel": "Back to ",
  "changesSaved": "Changes saved",
  "changesRestored": "Changes restored",
  "clearChanges": "Clear changes",
  "brandName": "CommTrackr",
  "createEstimatedTime": "Estimated time to complete: 2 minutes",
  "commissionNotFound": "The requested commission was not found.",
  "commissionLocked": "This commission is locked from user editing.",
  "resourceNotFound": "The requested resource was not found.",
  "offTitle": "CommTrackr Disabled",
  "offDescription": "Enable CommTrackr for your app using <code>commtrackr.on();</code>",
  "tenantMisconfiguredTitle": "Tenant Misconfigured",
  "tenantMisconfiguredDescription": "Configure your CommTrackr tenant using <code>commtrackr.init({ tenant: { ... } });</code>",
  "serviceOffline": "Service is currently offline.",
  "noSession": "No session found. Please enable cookies and try again.",
  "userNotAuthenticated": "User not authenticated. Please log in and try again.",
  "serviceNotConfigured": "Service is not properly configured. Please contact the administrator.",
  "noFieldsConfigured": "No fields configured for commission creation. Please contact the administrator.",
  "createSuccess": "Your commission was created successfully.",
  "syncSuccess": "Your commissions were synchronized successfully.",
  "updateSuccess": "Your commission was updated successfully.",
  "commissionNotFoundJson": "The requested commission was not found."
}

Handler Functions

The handler hooks give you full control over data persistence:
HookWhen CalledReceivesTypical Use
createAfter a commission is submitted via the UIreq, dataSave to a relational DB, trigger a webhook, log analytics
updateWhen a commission is edited by a dev or adminreq, dataUpdate external records, send notification emails, enforce business rules
syncWhen a user clicks SyncreqReconcile session data with a remote source, refresh cached commissions