Can Logaholic track outbound (affiliate) clicks?

2011-10-04 10:12:50Tags: track,clicks
I'm interested in Logaholic and wondered if outbound affiliate link clicks are considered conversions? I would like to track everytime a visitor goes to an affiliate as a conversion.


The answer is yes, this is possible, but not without some work. 

Normally a click to an external domain (or an affiliate link to some other server) cannot be tracked by your web statistics or analytics software, because the event is recorded on the remote site, not yours.

If you want to track outgoing, external links (affiliate or otherwise) you need to add some tricks. You need to make it record an event on your server before the visitor actually leaves.

Here is how to set it up:

The first method is to create a php script file that redirects a visitor to the external link you want.

In this case you could set your links up like this:

a href="/out_click.php?" 

Our example code in "out_click.php" could look like this:

header("location: http://$url");

So, now when a visitor clicks your links, they actaully access out_click.php on your server first, and are then automatically redirected the right website.

Tracking clicks

With the example above, the page /out_click.php will start appearing in your Logaholic reports, so you'll be able to see how many people clicked on of your (affiliate) links. In this case Pageviews will prepresent number of times clicked and Visitors represent the number of people who clicked. Because it behaves as a normal 'page', you'll also be able to check out click paths to it from any page, keyword etc.

You'll be able to see the number of clicks as a whole, but when you view the "Page Details" report, you'll also be able to see how many times each individual link was clicked. So, you can see which affiliate is getting the most traffic from you.

Tracking Exit Click Conversion rates:

If you are in the business of sending traffic to others, it's essential to keep track of your Click 'Conversion rates'. To do this, in our example we would just add "/out_click.php" to the Logaholic profile settings under Target files (Key Performance Indicators).

The file will now be available in your Conversion rate reports, so essentially you'll be able to see the Click Thru Rate (CTR) of your site on various levels: overall site, per page, keyword, referrer, trends etc etc.

What if you don't want to redirect or change all your links ?

Logaholic comes with the Exitclicks Expansion Pack. It's bundled in the logaholic software in the exitclicks_expansion folder.

The exitclicks expansion pack does exactly the same thing as described above, but takes a javascript approach.  You can have all kinds of reasons NOT to change your links, mostly related to search engines and optimization, so then the javascript method is a good approach. However, it's javascript so likey to be less accurate than the first method described.

With this solution, you can leave all your links the way they are, but you need to add the following: 

Installation Instructions

1. Copy the two files in this directory (exitclick.php ans exclicks.js)
   to the DOCUMENT ROOT directory of your website 
   (i.e ,
2. Add the following line of code in the <head> section of pages where 
   you want to enable exit click tracking:
   <script language="JavaScript" type="text/javascript" src="/exclicks.js"></script>
3. Edit the Body tag of the page and add the onmousedown section:
   <pre><body onmousedown="logaholic(event)"></pre>
4. Watch your Logaholic stats for ocurrences of /exitclicks.php
   Tip: Add this file to your list of Target Files (in your profile settings)
   to track conversion of external links !

NB: This script only works if you are using log files. It does not
function when using the javascript tracker to collect statistics.

The information on this page relates to older Logaholic versions (prior to Logaholic 6) and may be outdated.