Can anyone recommend some simple code to do this (or isn't it easy)? Thanks.
Te easiest way to track downloads is using whatever webstatistics package that most webhosts provide...
You can do it through PHP as well and store the results in a database of your own, but I don't have any readily available code to do so. Basically you can use a redirector link that forwards you to a page that has the code to log the info you want to a database, and also automatically initiates the download for you.