I've been using AdLogger for years to prevent Adsense click fraud. A long time ago, it also tracked your ads, but it's no longer being developed & the tracking function doesn't work. However, you can still limit the amount of clicks it allows per hour, can get an email notification of multiple click attempts that meets your limit and ban IPs. There's also options to disable viewing your Adsense ads or display alternate advertising.

It's free and the developer still makes it available: http://www.adlogger.org/.

Yes, it works. I set the amount of clicks per hour to a low amount...no one is going to be on my site for an hour, or for that matter, most anyone's site. You should have some experience setting up php scripts, however, I found it pretty easy to set up when I had very little experience.