# Other API functions

![](https://2006615411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ltuu0c63_YY4iXfi5vJ%2Fuploads%2FBflZHLVag3mj4aENZPGX%2Flogo.png?alt=media\&token=922c5956-0b6e-4fcb-85ff-059232bcf774)

## Client-side API functions

1. [Disable tracking yourself](#1-disable-tracking-yourself)
   1. `UST.disableRecord()`
   2. `UST.enableRecord()`&#x20;
2. [Force send the recorded data](#3-force-send-the-recorded-data)
   1. `UST.forceSendData()`
3. [Track a new pageview](#id-3.-track-a-new-page)
   1. `UST.trackNewPage()`

### 1. Disable tracking yourself

**Example**

```javascript
 // Starting with the next page load the tracking will be disabled
 UST.disableRecord();

 // Removes the "disabled" flag.
 // Starting with the next page load you will be tracked
 UST.enableRecord();
```

**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)

{% hint style="info" %}
**Note:** You can also use the **`ust-opt-out`** and **`ust-opt-in`** query strings to disable tracking on a specific website where the tracker is installed. \
Access that website and add the query string like this: **`www.site.com?ust-opt-out`**.
{% endhint %}

### 2. Force send the recorded data

**Example**

```javascript
// A request to send *new* data to the server will be created
UST.forceSendData();
```

**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](https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/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()`](#2-tag-visitors-dynamically)

### 3. Track a new page

**Example**

```javascript
// Creates a new pageview for this session
UST.trackNewPage();

// By default, it first sends all the cached data (recordings, movements)
// for the current page before creating a new page.
// If you want to avoid sending the latest stored data, you can pass `true`:

// Create a new pageview WITHOUT first sending the remaining data for 
// the curret page (discard currently tracked but not sent data)
UST.trackNewPage(true);
```

{% hint style="warning" %}
UST.trackNewPage() was added and is available from UXWizz version **6.5.0**
{% endhint %}

**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).
