-
Notifications
You must be signed in to change notification settings - Fork 8
Installation
Before you start, you need the following:
- The WT1 decompressed code archive
- A Java 6+ JDK
- Ant
- A servlet container, for example Tomcat 7.
The rest of this guide will assume that you are using Tomcat 7. For other servlet containers, please refer to your servlet container's documentation.
It is highly recommended to run the web application backend behind a reverse proxy, for the following reasons:
- Strongly restrict the exposed URIs: Only the
/public/p.gif
(and/public/events
if you want to use the JSON API) should be exposed on the Internet - The reverse proxy will offload from the servlet container the management of the client connections, and only keep a reduced number of persistent connections to the servlet container
For high-availability deployment, redundant load balancers should be used in place or in addition to the reverse proxy.
First, you need to edit js/track.js
and replace this.trackURL=""
by the URL on which the tracking GIF will be publicly accessible.
The tracking GIF is available on the /public/p.gif
subpath of your webapp's URL
The Javascript snippet can be served:
- By the web application backend itself
- By the reverse proxy
- By your CDN
Having the snippet served by the web application backend can provide a simpler deployment, but should only be used for development purposes.
If you want to have the snippet served by the web application backend, then you need to move the js/track.js
to the war-standalone
folder.
In this installation guide, we are going to use the filesystem flat files storage, and no custom handlers. For more information, please see:
-
Copy
war-standalone/WEB-INF/config-sample.properties
towar-standalone/WEB-INF/config.properties
. -
Edit
storage.params.rootDir
and replace it with the folder where you want the tracking logs
- Run
ant
- The web application war is produced in
dist/wt1.war
- Deploy the WAR on your servlet container
- Copy
dist/wt1.war
to thetomcat-folder/webapps
folder - If needed, start Tomcat :
tomcat-folder/bin/catalina.sh start
- Copy
If you have chosen to serve the Javascript snippet yourself (recommended production deployment), make sure that it is is available on your Web server or CDN.
The WT1 live data console can be accessed at URL_OF_THE_WEBAPP/internal/live.html
You can directly access the tracking GIF using URL_OF_THE_WEBAPP/public/p.gif
- Browse to
URL_OF_THE_WEBAPP/public/p.gif
- Browse to the live view console (
URL_OF_THE_WEBAPP/internal/live.html)
- Verify that one event has been logged
As you have accessed directly the tracking GIF, the stored data is incomplete
Create an HTML file like:
<html>
<head>
<script type="text/javascript">
var _wt1Q = _wt1Q || [];
(function() {
var script = document.createElement('script');
script.src = "URL_OF_THE_SNIPPET";
script.type = 'text/javascript';
script.async = "true";
var script0 = document.getElementsByTagName("script")[0];
script0.parentNode.insertBefore(script, script0);
})();
_wt1Q.push(["setVisitorParam", "userName", "testUser"]);
_wt1Q.push(["trackPage", { "pageInternalName" : "testPage"}]);
</script>
</head>
<body>
<input type="submit" id="s1" />
<script>
document.getElementById("s1").onclick = function() { _wt1Q.push(["trackEvent", {"pressedButton": "s1"}])};
</script>
</body>
</html>
-
Browse to the page
-
Browse to the live view console (
URL_OF_THE_WEBAPP/internal/live.html)
-
Verify that one event has been logged, with the appropriate values
-
On the test page, click the button
-
On the debug page, verify that another event has been logged
-
On the live view console, click the "Flush" button
-
Verify that a log file has been created in the storage folder
-
If applicable, verify that your handlers have received the events
You are now ready to start using WT1 in your web pages and to start tracking. For more information, please see the Developer's Guide