Other API functions

Client-side API functions
UST.disableRecord()UST.enableRecord()
UST.forceSendData()
UST.trackNewPage()
1. Disable tracking yourself
Example
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 this browser's localStorage for the current origin (protocol, hostname and port). For example,
https://example.comandhttps://shop.example.comdo not share this flag; HTTP and HTTPS do not share it either.Opt out separately on each origin and in each browser you use. Reload or open a new page after
UST.disableRecord(). Clearing the site's local storage can remove the flag.
2. Force send the recorded data
Example
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.
The tracker already handles page lifecycle events. Calling this method requests a flush; it does not guarantee delivery if the page closes or the network is unavailable. Do not rely on an extra
beforeunloadhandler to guarantee the final data arrives.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 useUST.addTag()
3. Track a new page
Example
Instructions
This is often used when tracking Single Page Applications (SPAs). You normally want to call this when your routes changes, to track a new pageview (otherwise UXWizz will keep recording data as being for the initial entry page, so you will have 1 pageview only per session).
Note that, when using the full session recorder, this also takes a new snapshot of the current page (to be able to view a recording of only the current page if needed).
Last updated