Installing webtuna.js

Choose where to load webtuna.js from

The webtuna.js file can be loaded either from your own webserver or from our globally distributed CDN (content delivery network).

Option 1 - Copy the webtuna.js to your web server(s)

  • Copy the webtuna.js file to the root directory or another suitable location on your web server using FTP, SFTP or your normal upload method.
  • Loading from your own server means you can decide when to update webtuna.js to a new version.

Option 2 - Load webtuna.js from our global CDN

  • A CDN is a content delivery network which caches content around the world.
  • webtuna.js can be loaded from rather than copying it to your own web server
  • If you load from here then it will automatically be updated to the latest version when we push a new release.

Insert the JavaScript code to load webtuna.js into the site template

This depends on your site and which framework, application or CMS (Content Management System) you are using for your site. Usually there will be a template, include file or master page which contains code which appears on every page on your site.

Code in the <HEAD>

This is an inline piece of JavaScript to save the time when the page starts to load. This should be in the <HEAD> section of the HTML as high up as possible. This timing is only used as a fallback start time for the first page view when browsers don’t support the Navigation Timing API. The code you should insert will look like:

<script type="text/javascript">var wt_start = new Date().getTime();</script>

Code before the closing </BODY> tag

This is the JavaScript which sets up the onload handler to beacon back the page timing information to the WebTuna server. This should be placed near the end of the HTML document, just before the closing </BODY> tag if possible. The code you should insert will look like:

<script type="text/javascript" src="/webtuna.js"></script>

Verifying the code

To verify that the code has been inserted into your page, load the page in your browser and refresh the page (CTRL-F5) to make sure you have the latest version. Then right-click and choose “View Page Source” and you should see something like this:

WebTuna HEAD code
WebTuna JavaScript code in HEAD of page
WebTuna BODY code
WebTuna JavaScript code before closing BODY tag

As soon as users now visit the site webtuna.js will begin collecting data.