Which links are users pressing to leave a page?
Posted on November 10th, 2009 in development |
A few months ago I wrote a script to monitor the links on a webpage that users are clicking on to leave the page.
The script is a combination of; CSS to label the links to be tracked, Javascript to trigger the code when the link is clicked and finally PHP to store the time, current page, destination page, browser agent and IP address of the user.
The links use a Class within the link to label the links to monitor and doesn’t change the link itself, retaining any referral address.
I wanted to test this out over time and give it an easy page to work with rather than putting it on to the blog straight away to monitor the links there.
I put the script on my own Murrion Software homepage which is a simple screen showing a logo and 3 links. This links go to this blog, a ‘tools’ page containing other free tools and scripts and also to a ‘contact’ page.
Here are the (rounded) percentages of clicks each button received from August to October inclusive.
‘Tools’ link : 41%
‘Blog’ link : 31%
‘Contact’ link : 17%
10% left the page without clicking any link.
It’s not quite a heat-map but it’s interesting to see. I’ve swapped around the buttons now to see if their position has any influence on clicks over the next 3 months. I imagine there will be little or no difference.




6 Responses
Hi Gordon,
Interesting exercise, but doesn’t most analytics software allow you to do this anyway?
I know that on Google Analytics I go to site overlay under “content” to overlay the data over the site itself. Every link on the page displays the % of total clicks, and you see the actual number of clicks that represents when you mouse-over the link.
I can click through the entire site like this, getting a representation of where people are clicking on every page of the site.
It’s a very useful visual tool to give you a feel for how people are navigating around your site, and where perhaps you could tweak things to improve conversion and/or user experience (which is often the same thing).
Cheers,
Calvin!
Hi Calvin,
Thanks for commenting.
Ya, Google Analytics does provide this same information. I wrote this script mainly because its a small part of a larger application I’m writing and also because I don’t trust Google Analytics half of the time.
Have you ever seen the differences in numbers GA will give you compared to a known number of inbound clicks from a shortened URL for example? For example, you could shorten a link using short.ie and its stats show 100 clicks, GA could tell you 20 clicks were received.
Google also doesn’t tell you the times or if the clicks were from humans or bots.
Gordon.
Hi Gordon,
I hear ya on the not trusting GA (or any analytics package exclusively, for that matter).
There are always going to be discrepancies between different analytics services / software. With so many variables involved its hardly surprising.
Even taking away the vagaries of different javascript tracking codes, different log-file analysis software can spew out remarkably different results from the same set of server logs.
That said, the example you quote seems a bit extreme… a figure five times lower on GA seems excessive. For me that begs the question which result is more accurate… and suggests that the two pieces of software are actually measuring different things.
GA doesn’t track visits from bots, because bots don’t trigger the javascript code on the GA servers. Taking your shortened URL example above, the link may have been clicked by 20 real live visitors with javascript enabled in their browsers, five real live visitors with javascript disabled in their browsers, and 75 visits from automated bots.
Result — 20 clicks recorded on GA, 100 clicks recorded on short.ie… both correct, but which result do you think is more valuable if you’re analysing human traffic?
It’s a good argument for using more than one analytics option, and using a combination of javascript tracking technology and server log files… but it all depends on what you want to measure, and how exacting you want to get in terms of detail.
Hi Calvin,
I didn’t know that GA didn’t track visitors from bots! That’s my new thing learned for the day, Thanks
It makes sense, I’d like to know how they differentiate regular browser agents from bot agents.
That’s a really good point about bots following shortened links too, I’ll have to look in to that and run a similar experiment recording the browser agents of referrals from shortened URLs posted to Twitter.
Maybe theres an opportunity there for a web application to take in GA info and other stat app info and compare them all automatically.
Gordon.
What about dynamic web pages? Can you use GA to track the clicks on links on these or would Gordon’s approach work instead?
Hi Padraig,
As far as GA is concerned I don’t think it makes any difference whether a page is dynamically constructed by the webserver or delivered from a static HTML file.
GA is triggered when the resulting HTML is rendered and the javascript GA code is invoked by a visitors’ browser. The browser itself passes on a string of information like the user’s IP address (which can tell you/your analitics software things like where they’re browsing from), OS, the URL they’re arriving from (along with any parameters, like search strings), etc.
So the short answer is yes, you can use GA just as effectively to track dynamic pages — with the added advantage that you don’t have to paste your tracking code into every page… you just add it to your template file and you’re done.