userTrack
Search…
Other API functions

Other client-side API functions

    1.
      1.
      UST.disableRecord()
      2.
      UST.enableRecord()
    2.
      1.
      UST.forceSendData()
    3.
      1.
      <input class='noRecord'/>

1. Disable tracking yourself

Example
1
// Starting with the next page load the tracking will be disabled
2
UST.disableRecord();
3
​
4
// Removes the "disabled" flag.
5
// Starting with the next page load you will be tracked
6
UST.enableRecord();
Copied!
Instructions
    To disable tracking yourself or other client you can call UST.disableRecord() from the JavaScript console or from a JS file.
    To re-enable tracking the curent client call UST.enableRecord()
    The tracking enabled/disabled flag is stored in the localStorage. As long as the browser localStorage is not cleared/reset this setting will persist. (eg: you won't be tracked again unless you clear all your browser data/cookies/localStorage)
You can also use the ust-opt-out and ust-opt-in query strings: www.site.com?ust-opt-out.

2. Force send the recorded data

Example
1
// A request to send *new* data to the server will be created
2
UST.forceSendData();
Copied!
Instructions
    userTrack sends data to the server in an efficient way: it batches multiple actions made by the users and sends all of them at once in a single request. This means that sometimes you have recorded data stored on the client that hasn't been sent yet (it's queued to be sent in a specific amount of time). You can call UST.forceSendData() to reset the time left to send the next batch to 0, thus forcing userTrack to send the data as soon as possible.
    One use case of this method is if you want to make sure the last seconds of the user's visit are recorded by calling UST.forceSendData() inside window onbeforeunload callback.
    You could also call this function after the user makes an important action that you want to make sure has been sent to the server (eg: user clicks a specific button). Note that in this case you should also use UST.addTag()​

3. Disable tracking a text input field

Example
1
// Add the `noRecord` class to the element to stop tracking keyboard input
2
<input type="text" name="my-sensitive-input" class="noRecord"/>
Copied!
Instructions
    By default all inputs with type="password" are NOT recorded.
    To disable keyboard input tracking for any other input simply add the class noRecord to the element.
Last modified 3mo ago