After creating my bbPress Google Analytics plugin, I wanted to do the same thing for WordPress. It is just as easy to do this as it is for bbPress. Your WordPress footer template should have a hook for adding code to the footer. If it doesn’t have this hook, you just have to add this piece of code,
wp_footer();, to your footer template. Then you just have to create the code that will add your tracking script to the footer of every page. That is it.
Here is an example of the code you can use. Download wp-analytics here. Just upload the script to your plugins directory, and activate the plugin in the plugin admin. If you are using Google Analytics, all you need to do is replace “UA-XXXXXX-X” with your site code. But it will work with any tracking script, just replace the Google script with your own. Also you can use this same code to add any code you wanted to the footer.