# Adding the tracking code

1. [Upload the script](/installation/installation/uploading-the-script.md)
2. [Create a new *MySQL database* for UXWizz](/installation/installation/creating-a-mysql-database.md)
3. [Run the auto installer](/installation/installation/running-the-installer.md)
4. **Add the tracking code to your site**

## 1.4 Tracking a domain

{% hint style="warning" %}
**Note: You should include the snippets provided in the UXWizz dashboard, which are unique for each domain.**
{% endhint %}

You can track unlimited domains on a single UXWizz installation. To track a new domain you have to do two things:

1. **Add the domain name** by giving domain access to your own user using the one of the *Add domain* buttons (from main overview, domain selector or settings→users).
2. **Include the tracking script on that domain**. On each page of the tracked domain you need to include this JavaScript file:

{% hint style="info" %}
**The actual snippets/links are provided in your dashboard!**
{% endhint %}

```html
<script>UST_CT = [];UST = { s: Date.now(), addTag: function(tag) { UST_CT.push(tag) } };UST.addEvent = UST.addTag;</script>
<script src="https://your.uxwizz.com/server/ust.min.js" async></script>
```

Add it just before the end of the ***head*** tag, like so:

```html
<head>
...
...
<script>UST_CT = [];UST = { s: Date.now(), addTag: function(tag) { UST_CT.push(tag) } };UST.addEvent = UST.addTag;</script>
<script src="https://your.uxwizz.com/server/ust.min.js" async></script>
</head>
```

**Note that if you want to use the AB testing feature the tracking code is bigger AND different for each domain (get this code from the interface, for each domain on the Domains page):**

```html
<script>
UST_CT = [];UST = { s: Date.now(), addTag: function(tag) { UST_CT.push(tag) } };UST.addEvent = UST.addTag;
// Prevent AB test flashing
(function() {var ust_s = document.createElement('STYLE');ust_s.id = 'ust_body_style';
ust_s.appendChild(document.createTextNode('body {visibility: hidden}'));document.head.appendChild(ust_s);})();
setTimeout(function(){ var el = document.getElementById('ust_body_style'); el && el.remove()}, 800);
</script>
<script src="https://your.uxwizz.com/server/ab/trackeddomain.com.ab.js" defer></script>
<script src="https://your.uxwizz.com/server/ust.min.js" async></script>

```

{% hint style="info" %}
**On what pages to include the script?**&#x20;

It is recommended to include the script on all pages, but you might not want to include the tracking script on sensitive pages such as the login page.&#x20;
{% endhint %}

{% hint style="info" %}

#### Different tracking settings for each domain?

If you want different tracking settings for each domain tracked you can change the settings inside the generated **ust.min.js** tracker file, saving it with another name (eg: ust.min.domain.js) and include this copy on the other domain instead of the original ust.min.js.&#x20;

**Note:** that when you do this, whenever you change settings in the UI, only the original ust.min.js will be updated/regenerated.

Domain-specific settings is a planned future.
{% endhint %}

{% hint style="success" %}
If everything worked as expected you should **immediately** see visitors data in your dashboard after a refresh, you can test if the script is working by visiting yourself the site you have installed the tracker on.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uxwizz.com/installation/adding-the-tracking-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
