Web statistics with
JKstats

JKstats visits example chart

Statistics analytics system for websites.

This system was made as my final project in the third grade in high school (in 2007). I loved programming and I loved web, so making a web based system was an easy choice.

I was aware of other great analytics tools, but wanted to make my own system to learn a lot. I had coded in PHP for a few years then, but I had never done anything in Flash, so that was the real challenge. I used Flash to build the charts, since I wanted them to be interactive. The user can hover on any column in the chart and see info about that period. It’s also possible to change between two different chart types: lines and bars.

The system is a bit more integrated with the site being logged than modern analytics tools like Google Analytics. It uses both client side and server side scripting to work. A piece of JavaScript collects info like the page’s title, screen resolution and the browser’s viewport size, then sends this through AJAX to a PHP file which collects the user agent string, referrer and some more info and finally stores all of this in a database. I use sessions to determine unique visitors. At the first page load a session is created and a unique visitor is added to the databae. For the rest of the page loads the script will sense this session and then only add visits to the database, connected to the user by an ID the visitor got on the first page load. When the session cookie is cleared (usually when the browser is closed) and the user visits the site again, another unique visitor is created.

Since a visitor ID is stored for each visit, it’s possible to track how a visitor has used the website. For each visit the timestamp is saved, and the duration for each page can then be calculated in the analytics system. This is shown in image 7, which shows a section where you find an IP number, choose a specific visitor of that IP number and then get the full tracking of that visitor. Every page load is shown, together with the duration for each page. In the top you can also see detailed information about the visitor’s system.

It logs the referrer of each visitor so you easily can analyze how people reach the website. If the user comes from a search engine, the system recognizes that and shows a more readable referrer like “Search on Google Images for: keywords” instead of just the URL.

There is also a section called Pages, where you can see stats for the different pages of your site.

There are three sections of the system that are pretty similar: browsers, operating systems and resolutions. They all give stats in number of unique visitors for properties related to the visitors’ systems. The browsers and operating systems can be analyzed both by name only and by all the versions. The data can be presented as either a table or a bar chart.

Visits (line chart)
Line chart for visits.
Visits (bar chart)
Bar chart for visits.
Referrers
Referrers that lets you see where the visitors came from. If this is a search engine you can also see the search keywords.
Pages
Shows which pages on your website that get most hits.
Browsers (table)
Shows which browsers that visitors have used to access the site.
Browsers (bar chart)
Bar chart for browser usage.
Visitors
This section lets you see details about a specific visitor and which pages that were visited.