There are 2 ways to go:
1) Inside WP Admin navigate to Appearance > Editor and look up the 'footer.php' file of your current theme. Click the 'footer.php' file, so that you see its code and right above the </body> tag in the code of 'footer.php' place the click tracking code
. Hit "Update File"
2) You can take use of the Post Affiliate Pro plugin developed for WordPress: