Analyzing Website Traffic Part 2


 Analyzing Website Traffic Part 2

In this series, we’ve been looking at web content through the browser. This time, we’re going to take a look at the server side of your site and see what analytics are available there. Some of this information can be found in Google Analytics as well, but it is nice to have access to a variety of pieces of data so that you may compare them and find patterns that can help improve your website traffic.
            Some of the information that is easier to gather in Google Analytics is referral data. This includes both direct and back-end links. The problem with this, one that we will have trouble with later on, is that you must have a unique link on each website for each referral. That makes it a bit difficult to compare (you would need to know what the referrer was on each page in order for this data to be helpful).
            Another interesting metric is the referring domain. If we could somehow know how many users came from each specific part of our site, we could perhaps make changes or changes where there are high numbers of visitors from certain parts of our site (making changes where possible would help us). Unfortunately, this isn't an easy metric to collect. It would be great if we could just ask our server what are the highest numbers of visitors were from which part of our site. But there is no such method to do that in PHP.
            We could however collect all of this data by hand, and analyze it that way. That’s essentially what I did here - though it was a bit easier because I have total access to the server and the code on the server is mine (I used a popular open source CMS and a small plugin that gave me access to this information). Still, even with those advantages I had to do quite a bit of work just to get these metrics.
            Now that we know how to gather data, let’s see what kind of things we can find.
Note: everything in this blog post is done using the WordPress Dashboard. This is not a WordPress tutorial, and I don’t claim to know how to do anything specific with WordPress - please leave feedback or comments on how you would do things differently if you find it helpful!
            The first thing we need to do is tie into the server by creating a new database connection that is only for this purpose (we will call it wp_analytics ). I added an SQL query below that will pull these metrics out on every page load. Obviously, the queries are different as they are pulling the information from the individual pages.


Despite some drawbacks, it is possible to gather analytics data from the server and compare it to the data that we get from Google Analytics. This article was an attempt at making that comparison more accessible by allowing people who do not have access to the server or code on the server, but have Google Analytics installed.
            As a disclaimer - this method is not perfect, and there are several parts that may be added/changed in order to make this better (for example; I haven't added a way of pulling all pages together for analysis and comparing them, nor have I added any ability to parse out referring domains).

Post a Comment