Tracking multiple sources of traffic

Hi,

This might be a simple question, but I have an affiliate site that I want to drive traffic to, and the traffic will be coming from various sources.

All I want to know is that I got the traffic count that is being contracted for from each source...

My first thought is to create a sub-domain for each traffic source and utilize a DB update query to increment the visitors on the index page for that sub-domain, and then Automatically redirect the visitor to the actual affiliate page.

This would accomplish 2 things -

  1. give me a count on each sub-domain to compare to the contract
  2. make the link easier without the affiliate code at the end of it.

I guess the basic question is whether there is an easier quicker way to do this other then creating a mysql table to keep track of the visitor count per sub-domain?

Suggestions are welcome.
Thanks
Douglas