Use Custom Variables in Who's On Tracking Scripts

Incorporating custom variables into your Who's On script allows you to track additional information about your website visitors with Who's On. To use custom variables in Who's On, you will need some knowledge of JavaScript and you will need to modify the Who's On tracking script that is placed on your webpage. NOTE: Because you cannot modify the portal script, custom variables cannot be used on portal pages.

Applies to SmarterTrack 10.x-12.x

This functionality has been removed from SmarterTrack.


Applies to SmarterTrack 6.x - 9.x

Follow these steps to set up custom variables for Who's On tracking:

  1. Log in to the SmarterTrack management interface as a system administrator.
  2. Click the settings icon.
  3. Expand the System Settings and Who's On folders.
  4. Click Who's On Settings in the navigation pane.
  5. Fill in the parameters that you want the script to be generated for and click the Generate button in the content pane toolbar.
  6. You can collect more information on your visitors by manually adding the following custom variables to your tracking script:
    • SetSTVariable(key, val) – If there is an existing variable with the key specified the value for this entry will simply be updated. However, if a key does NOT exist, it will just create a new variable.
    • ClearSTVariable(key) – Removes a custom variable for this visitor. If a variable doesn't exist for this key then this function is ignored.
    • ClearAllSTVariables() – Removes all custom variables for this visitor.
    • ClearSTVariableStartingWith(key) – Removes all variables starting with the provided key. If a variable key does not start with the specified key then this function is ignored 
  7. Copy and paste the script into your website.
  8. The data collected from the custom variable will now appear under the Custom Variable tab when viewing a visitor in Who's On.

In the example script below, the Who's On tracking script has been edited to create a custom variable called "Shopping Cart." The tracking script is generated automatically by the Who's On settings page in SmarterTrack. The object "strack_portal" is what is used to communicate with the SmarterTrack server and for it to track all current information about your visitor. Custom variables are also set through the use of this tracking object. NOTE: All custom variables must be set after strack_portal.TrackPage(); in your tracking script.

For more information, please refer to the Who's On section of the SmarterTrack Online Help.


Learn more about the SmarterTrack online help desk and how you can improve your overall customer service.