#native_company# #native_desc#
#native_cta#

User Route Tracing

By Duncan Fordyce
on April 13, 2001

Logging is an old subject. It’s simple just record the page requested,
time, IP number and maybe the refering URL. Instantly you can draw up
graphs on the most popular pages, the best referers etc. This in its own
right is very useful. However, when I was looking at the logs on one of
my larger sites, I thought – I know that page “x” gets so many hits a
day, but the user could have come to that page using a variety of different
routes. How do users get to page “x”? On some sites there is a variety of
different ways to reach the same page. On PHPbuilder for example, most
people probably see the list of new articles and choose one of those. How
many people go to the columns page and look at all the articles? This isn’t
the best example but I think you get the idea. If you know this information
you can see how effective your navigation system really is.
This idea can be implemented in a very simple way to begin with. By using
the refering URL you can get some insight into how they got to a page. I keep
my own logs as described in this
article
. I don’t filter out the query string because I want to know exactly
where users have looked, this means that if someone came from a search engine
I can see the keywords they entered to find my site and if they enter a page
that is only available through a query string I can see that too. I use a
mySQL table like this to keep all my logging information in :
create table logging
	(
	timestamp BIGINT,
	remote_ip char(15),
	page text,
	refering_page text
	);
Then I can use a query like this for some basic route tracing :
SELECT count(refering_page) AS hits,refering_page FROM logging WHERE page=”pagex” GROUP BY refering_page ORDER BY hits
Instantly an ordered list of how most people get to a page. Now this is all well and good I hear you say but thats hardly a route!