Tracking Overview

By December 7, 2017Tracking

Gauges tracks your website using a simple JavaScript snippet. The snippet uses a few techniques to ensure that tracking does not hinder the experience of your site’s visitors in any way.


<script type="text/javascript">
var _gauges = _gauges || [];
(function() {
var t = document.createElement('script');
t.type = 'text/javascript';
t.async = true;
t.id = 'gauges-tracker';
t.setAttribute('data-site-id', 'this is different for each gauge');
t.src = 'https://secure.gaug.es/track.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(t, s);
})();
</script>

 

Note: Each gauge has its own unique tracking code, so be sure to copy it from the link on the dashboard instead of trying to use the example above.

Multiple Gauge tracking

You can track a single view to multiple gauges simultaneously by modifying the data-site-id attribute to be a list of gauge ids separated by commas.

<script type="text/javascript">
var _gauges = _gauges || [];
(function() {
var t = document.createElement('script');
t.type = 'text/javascript';
t.async = true;
t.id = 'gauges-tracker';
t.setAttribute('data-site-id', 'gauge1id,gauge2id,gauge3id');
t.src = 'https://secure.gaug.es/track.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(t, s);
})();
</script>

Note: Be sure to replace gauge1id and friend with the ids of the actual gauges you want to track.

Single Page Tracking

The tracking script is setup to record each time the page does a full load. If you need to track views in between full loads (perhaps due to AJAX), you can use the following technique anywhere on the page to track another view.


_gauges.push(['track']);

This will force another track of whatever the current url is. In order for this to work, you need to have the latest tracking code, which should look something like the example code in the previous section.

Leave a Reply