Knowledge Base

Search ClickTracks:

Tracking links to third-party affiliate links


The secret is out--operating an affiliate aggregation site can be an extremely lucrative business. And having great web analytics that highlight when, where, and under what conditions people are clicking on certain affiliate links can make a huge positive impact on your bottom line.

But there's a technical challenge in doing such tracking—a challenge that stems from the fact that you don't have control over data from the affiliate program. The way ClickTracks (or any other web analytics software) knows about clicks on a link isn't magic, but rather purely technical: When the linked-to page is loaded, a record of that request is noted. This occurs regardless of whether the request is captured in the web server's log files, or in another other data collection system that is triggered by some JavaScript (or a .gif image or some other piece of code) within that site.

The issue surrounding affiliate links occurs because you don't have access to data that isn't on your own site. In an affiliate program, you neither have access to the affiliate program's log files, nor can you put code on their site that will cause the page request to be recorded in a place where you could access the data.

When it comes to getting information about clicks to affiliate programs, you're at the mercy of the affiliate program to provide you with that data. Though there generally isn't any issue with the accuracy of the information your affiliate program provides, there IS an issue with the comprehensiveness of the data. Affiliate programs typically show you the total number of clicks to their site and the number of conversions--but that's about it. You won't gain insight into which of your pages are generating the clicked links, which of your own site referrers sends visitors who are more likely to click into affiliate links, or a wealth of other information that can help you make the most of your affiliate efforts.

Solving the Affiliate Link Click-through Dilemma

So is there a solution to this problem? Yes, there is, and it is surprisingly simple. The key, as suggested above, is to record the click through to the affiliate program in your log files. This is done with a redirection page (also called an 'exit' page).

The way a redirection page works is that instead of linking directly to an affiliate page, your affiliate link FIRST sends visitors to a page within your own site that immediately forwards the visitor to the appropriate page of the affiliate program's site. The redirection happens so quickly that the visitor can't tell the difference—they never realize that they were just redirected through another page--but it does allow the request for the exit page to get recorded in your log file. What does this mean? Now you have a record, in your own data, of that visitor's click.

The following diagram illustrates how this works. It shows two scenarios: one without an exit page and the other with an exit page. In either case, the original request for your page is logged on your server and the request for the affiliate page is recorded on the affiliate's server (thin, red dotted lines). But in the exit page scenario, there is another request recorded in your log—the thick, red dotted line that shows the exit to the affiliate program.

There are many ways to set up a redirection page, and it's easy--most web developers should find this to be a fairly straightforward task. Just in case, we've provided step-by-step instructions below so that even those of you without computer science degrees can set up affiliate link tracking.

Step 1: Create the redirection page

Download the file, which contains a small HTML document containing JavaScript code.   This is the code that automatically redirects the visitor to the affiliate site. You don't need to worry about how it works. Just upload the file to your server with the rest of your pages and it will do the job.

Step 2: Modify your links to the affiliate program

Next, you'll modify the affiliate links within your pages so that they link to the redirect page instead. They'll also pass along the information about what page they are ultimately being sent to as a URL parameter. So for example, a link to a site that looks like this:

a href="">

would be changed to this:

a href="goto.html?url=">

Notice that the second link is going to the goto.html page you created in Step 1 and passing a parameter named "url", the value of which is the actual affiliate link. This is an extremely easy change to make within your code using a global find and replace function available within pretty much any web editor. In this example, you simply find all occurrences of 'a href="">' and replace them with 'a href="goto.html?url='.

Step 3: Final check

You should check each of your links and make sure that the redirect works and that your affiliate data is correctly passed to the target site. Don't skip this step because your revenue depends on it That's it! Three steps. Once you've made these changes, you'll have data about all the clicks to affiliate programs within your log files. Then you'll be able to use ClickTracks to learn all kinds of valuable information about which referrers, keywords, pages, etc. are working the best for you.