Adding the tracking code

  1. Add the tracking code to your site

1.4 Tracking a domain

You can track unlimited domains on a single userTrack 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 (actual link provided in your dashboard):

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

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

<head>
...
...
<script>UST_CT = [];UST = { s: Date.now(), addTag: function(tag) { UST_CT.push(tag) } };</script>
<script src="https://site.com/userTrack/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):

<script>
UST_CT = [];UST = { s: Date.now(), addTag: function(tag) { UST_CT.push(tag) } };
// 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://site.com/userTrack/server/ab/usertrack.net.ab.js" defer></script>
<script src="https://site.com/userTrack/server/ust.min.js" async></script>

On what pages to include the script?

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.

Different tracking settings for each domain?

If you want different tracking settings for each domain tracked you can change the settings from tracker.js, saving it with another name (eg: tracker-domain1.js) and include this copy on the other domain instead of the original tracker.js.

Note: that when you do this, whenever you change settings in the UI, only the original tracker.js will be updated.

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.