 <p>You could either use <code>setInterval</code>:</p> <pre><code>window.setInterval(jTTrackPage, 10000); // call it every 10 000 ms = 10 s </code></pre> <p>or <code>setTimeout</code>:</p> <pre><code>function trackPage() { jTTrackPage(); window.setTimeout(trackPage), 10000); // call the function again in 10 000 ms } trackPage(); </code></pre> <p>The difference between both is that the first one calls it every 10s, and if one call takes more than 10s (unlikely here) the next one will be triggered just after, without waiting 10s. The second solution solves this problem.</p> <hr> <p>You can clear an interval or a timeout using respectively <code>clearInterval</code> and <code>clearTimeout</code>:</p> <pre><code>var interval = window.setInterval(jTTrackPage, 10000); window.clearInterval(interval); // &lt;-- stop it var timeout = window.setTimeout(trackPage, 10000); window.clearTimeout(timeout); // &lt;-- stop it </code></pre>